GIT: push to the current branch

The first time you use GIT you will get an error when you try to push changes to a remote repository.

This happens because GIT doesn’t know which remote branch matches the local branch you’re trying to push.

To avoid this error you can follow the advice in the error message, however you would have to do this for each new branch you want to push to the remote repository. You can also make this behavior permanent by updating your default push strategy in your global GIT config using the following command:

git config –global push.default current

This push strategy pushes the current branch to update a branch with the same name on the remote repository. If the branch doesn’t exist on the remote repository, it gets created.