git push to existing remote branch

sandeeps picture sandeeps · Sep 19, 2012 · Viewed 43k times · Source

How do I push changes from a local git branch to an existing non-master remote branch? If I do a "git push", it tries to push changes in all local branches to the remotes they are tracking.

Answer

Greg Hewgill picture Greg Hewgill · Sep 19, 2012

To do this you use a refspec, as explained in the git push documentation. For example:

git push origin local_branch_name:remote_branch_name