What are .rej files which are created during merge
Asked Answered
B

2

33

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.

Bailiwick answered 4/1, 2016 at 6:35 Comment(3)
They are rejection files, describing "failing" merges; you certainly need to look into them.Rivarivage
The 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 ?Bailiwick
Did you look inside some .rej file? Read help.github.com/articles/…Rivarivage
A
46

.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.

Arlina answered 4/1, 2016 at 6:52 Comment(9)
I 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.Bailiwick
No. .rej files should be created when there is a problem onlyArlina
Thanks 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?Bailiwick
A 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 hourArlina
@codWizard Thanks a lot.Bailiwick
Np. fell free to read some of my other answers as well and vote for them if you find something new in them.Arlina
I guess I can simply solve conflicts manually, and then ignore all .rej files?Abstinence
@Arlina 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.Kapp
Hey 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 and manually merge ..... It gives impression that after .rej is created, we have an option to do git 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! +1Isogloss
T
-2

Since I knew that my remote master branch was up to date, I just deleted all the .rej files and then did git pull.

Teat answered 15/5, 2020 at 16:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.