git push origin HEAD

I found, in the official guide:

git push origin HEAD

  • How do I clean up the .gitignore file?
  • how to include git commit-number into a c++ executable?
  • Git over samba - unable to write sha1 filename | Permission denied
  • What is the best strategy to store in repository only changed files?
  • Combining gh-pages and wiki in the same branch
  • How to see git diff from very beginning to the HEAD?
  • A handy way to push the current branch to the
    same name on the remote.

    However, the meaning of the command is not clear to me. Why does it have this effect?

    I haven’t been able to find an answer (this question seems to treat the problem, but the title is misleading).

  • Remove git submodule/repo inside repo fatal: Pathspec '' is in submodule 'x'
  • Not all files added to Git repository
  • TeamCity non-deterministic build triggering with Git
  • Git Merging Issue two branches
  • Git Ignores and Maven targets
  • Git: When did a branch got merged into master?
  • One Solution collect form web for “git push origin HEAD”

    HEAD points to the top of the current branch. git can obtain the branch name from that. So it’s the same as:

    git push origin CURRENT_BRANCH_NAME

    but you don’t have to remember/type the current branch name. Also it prevents you from pushing to the wrong remote branch by accident.

    If you want to push a different branch than the current one the command will not work.

    Git Baby is a git and github fan, let's start git clone.