Set master as the default branch for push and pull
The command git pull have always given me the following boring message:
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.active_model.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 <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "branch_name"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
To solve this I added some configurations to git's repo config file by the following commands:
$ git config branch.master.merge refs/heads/master
This command tells git that when you're on the master branch, the default remote is origin
$ git config branch.master.remote origin
This command tells git that when you're pulling from the master branch, it must use the default remote specified with the previous command
Written by Davide Targa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Config
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#