Import a merge commit from on branch to another branch

git diff  the-commit-before-your-commit your-commit > abc.diff
git apply --reject --whitespace=fix abc.diff 
#If you not lucky, you will see some *.rej files generated, which mean failed patchings
#You can still a tool to called "wiggle"  deal with them
tar xvf wiggle-1.1.tar.gz
# You may have to install ncurses library first
sudo yum search ncurses
sudo yum install ncurses-devel
# Then you install wiggle
sudo make install 
#Now you can use wiggle to fix those rejected files 
wiggle --replace some.file some.file.rej  # Try its best to do a merge

Now go to some.file and manually fix some conflicts if wiggle says there is an. After all that you can commit your changes. 

#Check if the git patch session is done
git status
#If it says you are still in the middle of git apply session, just try
git am --resolved  # if there is never a conflict
# or
git am --skip  # If there is a conflict you can just end this session.  Don't worry, you have committed you thing. It won't do any change.  

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.