I am very new to git. I wonder -- is it possible in git to merge two files (from different branches) multiple times? e.g. say I have file.txt in the master branch, and another version of the same file in the test branch. Now, there are two particular fragments in the test branch file that I would like to merge into the main one; but I'd like to do it sequentially, so that I could verify the effects of each change.
So I do git merge test --no-ff
, this produces conflicts. I edit the file to merge the first fragment from the test branch and keep the second one as it was on the master branch, and test if everything is OK.
After that, I would like to do the same thing again with the 2nd fragment that I have previously ignored; however git merge
refuses to do anything as it says things are up to date, because the file in test has already been merged once.
Is there a way to force git to conduct such a repeated merge? I figured that I can use git show
to produce a temporary copy of the file in the test branch and then copy-paste, but this seems ugly.