Whenever I clone a repo from Github I'm used to being able to use
git pull and
git push on their own to pull and push from origin and to master respectively.
When I set up my own git repo outside of Github, I wondered why these didn't work out of the box. Executing those commands would give me an error saying Git doesn't know which branch to merge with...
It turns out you can set up your preferred remote and local branches to pull and push to and from. Just edit the config file inside the
.git/ directory in your local repo.
You may find that if you added a remote repo previous the
[remote] section will already be present.
[branch "master"] remote = origin merge = refs/heads/master [remote "origin"] url = url/to/my/gitrepo.git fetch = +refs/heads/*:refs/remotes/origin/*