pushing to git remote branch

As Abizern says, this works:

git push origin mybranch

But, to explain further, the mybranch part is a refspec. This specifies the remote ref which should be updated with the given local commit.

So, the command above is equivalent to:

git push origin mybranch:mybranch

or even:

git push origin mybranch:refs/heads/mybranch

and, indeed, since you’re on the local mybranch, you could have done:

git push origin HEAD:mybranch

This is good to understand, because I often find myself doing things like:

git push origin HEAD^:mybranch

where you want to push all but the topmost patch to the remote branch.

Finally, if you want to delete the remote mybranch, you do:

git push origin :mybranch

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)