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.
- git diff to see what a merge would introduce
- Composer & composer.lock in GIT and merge conflicts
- Remove a merge commit, keeping current changes
- Get the first commit date of a Linux stable branch
- Git: having problems trying to keep a clean history tree
- Can I merge 2 similar, but non tracked repositories in Git?
2 Solutions collect form web for “Git pull and merge during a merge”
- 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.
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.