What are .rej files which are created during merge
.rej
files are rejected files (usually hunks patches but not only).
When ever you get those files after merge you will manually have to edit them, fix them and then apply them back.
You can read here some more about it and what is it
.rej
file
diff a.txt (rejected hunks) ....
Fix it manually and then apply the .rej
files like a regular patch.
manually merge the change from *.rej
into the required file and remove the *.rej
file.
Another very usefully article addressing this can be found here.
Related videos on Youtube
GajanaN Chalke
Updated on May 20, 2021Comments
-
GajanaN Chalke almost 3 years
I was merging master branch into new branch, there are some .rej files are created.
I took a pool of master branch into new branch I got conflicts which I've resolved but there are some .rej files.
Can you please help me to know about the .rej files and what am I suppose to do with those files.
-
Basile Starynkevitch over 8 yearsThey are rejection files, describing "failing" merges; you certainly need to look into them.
-
GajanaN Chalke over 8 yearsThe steps that I've followed are correct or wrong? Actually development was going into Master but for new UI changes new Branch was created mean while some changes has been made into master, so to reflect those changes I took a pool of Master into new branch and I got conflict which I've already resolved but not able to understand about the .rej files. Can you please explain a little bit about failure and cause ?
-
Basile Starynkevitch over 8 yearsDid you look inside some
.rej
file? Read help.github.com/articles/…
-
-
GajanaN Chalke over 8 yearsI checked the file from both i.e. from master & new branch using beyond compare tool, actually there is no difference not even blank line, in such a case .rej file should not be created, right? Then why .rej file is created? is there any step I missed while merging master into new branch? #I'm using SourceTree for UI.
-
CodeWizard over 8 yearsNo.
.rej
files should be created when there is a problem only -
GajanaN Chalke over 8 yearsThanks a lot @codeWizard, it worked! I merged the branches successfully. Is there any better way(if the way I merged the branches is wrong) to merge the master branch into newly created branch?
-
CodeWizard over 8 yearsA better way to merge? depends on several things, how many commits, how many branches, basically - merge often as much as you can to avoid conflicts. you can do a git pull every hour
-
GajanaN Chalke over 8 years@codWizard Thanks a lot.
-
CodeWizard over 8 yearsNp. fell free to read some of my other answers as well and vote for them if you find something new in them.
-
Ben Carp over 6 yearsI guess I can simply solve conflicts manually, and then ignore all .rej files?
-
manish ma about 3 years@CodeWizard hi, thanks for your answer. I still don't understand how to edit these .rej files. Maybe there was information in the link you provided - but it appears to be broken.
-
haxpor almost 3 yearsHey thanks for the info! I think it's slightly confusing for the line
Fix it manually and then apply the .rej files like a regular patch
andmanually merge ....
. It gives impression that after.rej
is created, we have an option to dogit apply
with that.rej
again, or manually do the merge from diff in.rej
ourselves. The article you linked in did the latter way though. Anyway, thanks for info! +1