Gitology Recipe: Avoid Having to Specify Which Branch to Pull (Set Master as Default Remote Branch)
Note: This article is a draft, is subject to revision, and is possibly incomplete. This notice will be removed when article is final.
When Git doesn't know which remote branch you're trying to pull, you'll see a message that begins: "You asked me to pull without telling me which branch you want to merge with..." Most commonly, you're pulling from master, and you can specify it explicitly like so:
But what if you're always (or almost always) pulling master? Wouldn't it be great to be able to set master as the default and simply type:
You just saved 14 characters of typing! Who wouldn't want that? If you want master to be default on a remote pull, simply add the following lines to your .git/config:
You can add the lines shown above by editing .git/config or via the following commands: