Quantcast
Viewing all articles
Browse latest Browse all 6

Make git-push Easier with a Small Config Change

When pushing to a remote branch, normally you need both a remote and a branch name, like so:

$> git push <remote-repo-name> <branch-to-push>

Setting a remote repo’s push config to “HEAD” will make this process easier:

[remote "github"]
  url = https://github.com/username/repo.git
  refs = # ...
  push = HEAD

This will do two things:

1. You no longer need to specify the branch when you push
2. It will automatically push the branch you are currently in

Pushing now looks something like this:

$> git push <remote-repo-name>

This way, if you are in master, it will update the remote’s master branch.

If you are in a new branch and you push, it will create that remote branch. For example, if we just checked-out “sakura” and we push, it will create the “sakura” branch in the remote repository.


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 6

Trending Articles