0

I am trying to do a merge for one file from another repo and I found this slides is working exactly what I want Git merge single file from another repository into my own

And the command I am using is:

git checkout -p other/target-branch target-file.ext

But the issue I met is that I was asked by something like below (probably due to conflict merge?)

--- b/xxxx/test.pl
+++ a/xxxx/test.pl
@@ -46,9 +46,6 @@ push( @INC, $1 );
-$xxxxxxxxxxxxxxxxxxxx;
-
 &main;


Apply this hunk to index and worktree [y,n,q,a,d,/,j,J,g,e,?]?

those two test.pl were 99% the same before and as the a/xxxx/test.pl has been updated, I thought I shall do a merge so that my own test.pl keeps all the history of a/xxxx/test.pl.

Problem is that I don't know how to use [y,n,q,a,d..] to handle this conflicted merge, and I know there is a gui tool "git mergetool" which will trigger like kdiff3 to make everything easier, how may I use merge gui with this checkout command?

I am quite new to git. So I am doing everything in the correct way?(using checkout for a merge, I olnly find this checkout way works for me proberbly. Or shall I use some git merge command)?

Community
  • 1
  • 1
thundium
  • 995
  • 4
  • 12
  • 30
  • Any reason you only want the changes introduced in test.pl rather than all the changes introduced in `other/target-branch`? – Kyle S. Jul 25 '16 at 16:41
  • 1
    That's not a merge conflict, it's a patch hunk. There are some differences between the files, and it's asking you if you want to add those changes one by one. If you want all of them, then drop the patch `-p` flag and just `git checkout other/target filename` otherwise, just answer yes/no for each interactive patch step. – Jeff Puckett Jul 25 '16 at 17:28

0 Answers0