3

With Git I have done a pull on the other developers branch, then I merged into my branch. When I ran the app I realized the other developer forgot to check in a new resource, he promptly checked it in. How do I grab that new file while I'm in the middle of a merge?

I don't want to lose all the work I did with the mergetool by undoing what I have so far. I also don't want to check it in as I can't test it without the resource file and I don't want to check in broken code.

Ian Hern
  • 641
  • 1
  • 8
  • 16

2 Answers2

2

You could:

  • fetch (which doesn't require that your working tree is clean, meaning your merge is still in progress)
  • checkout the file from origin/otherBranch (as in "How to get just one file from another branch")

    git checkout origin/otherBranch -- aFile
    

That would override 'aFile' though, which means I assume your merge in progress doesn't involve that file, or the work o it would be lost.

As The OP Ian Hern mentions, you also can checkout the branch after pulling the other branch.
Redoing a merge then can work.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I haven't tested this as I didn't want to wait so I just checked in a broken commit, will try it if it ever happens to me again (it probably will lol). – Ian Hern Jun 05 '14 at 19:57
0

I was able to checkout that other branch, do a pull, and then checkout my mid-merge branch again. And then ran merge again and it added it in.

Ian Hern
  • 641
  • 1
  • 8
  • 16