Friday, January 18, 2013

So which branch do I want to merge with?

You type git pull at the command line, then you get a message that says:
You asked me to pull without telling me which branch you want to merge with, and 'branch.master.merge' in your configuration file does not tell me, either. Please specify which branch you want to use on the command line and try again (e.g. 'git pull '). See git-pull(1) for details.
It goes on to say that you can make an addition to .git/cofig to correct the underlying issue.    I think that is too many keystrokes.   Use the handy git config command to make those changes for you:
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
This is probably going to happen again, so lets add a git alias:
git config --global alias.fixmaster \
    '!git config branch.master.remote origin && \
    git config branch.master.merge refs/heads/master'
Now if you get this error again, just type git fixmaster.

No comments: