git

Git: how to push

Seemingly simple thing, but causes so many problems: how to push into _current_ branch, without specific name.

https://stackoverflow.com/questions/14031970/git-push-current-branch-shortcut

https://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified

So, number 1:

git config --global push.default current
git push

Where push.default can be:

  • nothing: do not push anything
  • matching: push all matching branchesAll branches having the same name in both ends are considered to be matching.This used to be the default, but not since Git 2.0 (simple is the new default).
  • upstream: push the current branch to its upstream branch (tracking is a deprecated synonym for upstream)
  • current: push the current branch to a branch of the same name
  • simple: (new in Git 1.7.11) like upstream, but refuses to push if the upstream branch’s name is different from the local one

or, number 2:

git push origin HEAD


Hi, I’m AK