Making a Git push from a detached head

If you are on a detached head and you want to push to your remote branch git push origin HEAD:name-of-your-branch otherwise you can create a new branch and push to it ( it will be created automatically ) git branch new-branch-name git push -u origin new-branch-name

What does ‘–set-upstream’ do?

To avoid confusion, recent versions of git deprecate this somewhat ambiguous –set-upstream option in favor of a more verbose –set-upstream-to option with identical syntax and behavior. [ Reference ] git branch –set-upstream-to <remote-branch> sets the default remote branch for the current local branch. Any future git pull command (with the current local branch checked-out), will … Read more