Ian Hern
Ian Hern

Reputation: 669

Git pull and merge during a merge

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.

Upvotes: 3

Views: 93

Answers (2)

VonC
VonC

Reputation: 1328282

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.

Upvotes: 2

Ian Hern
Ian Hern

Reputation: 669

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.

Upvotes: 0

Related Questions