If I'm working on a branch and then realize I need to merge another branch into mine here is my current workflow (for this example lets say that I'm working on my-branch and want to merge in master):
git stash git checkout master git pull git checkout my-branch git merge master git stash pop Is there a way in git to pull a branch other than the currently checked out one, or is there a better way to do this?
For example, here's what I'd like to be able to do (again lets say I'm on my-branch and want to merge in master):
git pull master git merge master The git-pull man page says that a git pull is just a get fetch followed by a git merge, so is there a way to do the merge part of the git pull on a branch other than the one that's currently checked out?
Or is what I'm asking for just not possible?
git pullbecause it can introduce a merge commit behind your back, and I'm looking to bring all my tracking branches up-to-date. To that end, I wrote an addon that will fetch and fast-forward any tracking branch. Myself and others have been using it for quite some time, and it's definitely a time-saver. The nice part is that if it's not a fast-forward merge, it will leave you to resolve it and make it better. This works well for us since we use a rebase workflow quite often.masterintomy-branchdon't I have to?