stonean

trying to be better than I was yesterday

git pull origin master config

Thursday August 13, 2009 @ 09:27 AM (UTC)

After creating a few repos in github, initializing them and running into the same problem I decided to figure out how to fix it.

Here’s the message:


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
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to
configure the following variables in your configuration file:

branch.master.remote = branch.master.merge = remote..url = remote..fetch =

See git-config(1) for details.

You can get around doing config changes by adding additional parameters to the git pull command:

git pull origin master

But who wants to do that everytime? Not me. Especially since I have my aliases setup:


alias ga='git add'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gd='git diff'
alias gko='git checkout'
alias gl='git pull --rebase'
alias glv='git pull -v'
alias gp='git push'
alias gpv='git push -v'
alias gs='git stash'
alias gst='git status'

So the right thing to do is fix this by modifying .git/config in your repo and adding the following section:

[branch "master"]
  remote = origin
  merge = refs/heads/master

Now I can use my aliases as I like and know a little more about git.

It’s a process.

Comments

New comment

required, won't be displayed

optional

Don't type anything here unless you're an evil robot:


And especially don't type anything here:

Basic XHTML (including links) is allowed, just don't try anything fishy. Your comment will be auto-formatted unless you use your own <p> tags for formatting. You're also welcome to use Textile.

Copyright © 2010 stonean. All rights reserved.
Powered by Thoth.