How to Push to a Git Remote Branch of a Different Name

Git is one of those tools that I’ve always known just enough about to be dangerous, and usually tend to learn new skills when I’m in a position to truly need them. Shockingly enough it has taken me roughly 15 years of using git for me to encounter the need to push to a remote […]

The post How to Push to a Git Remote Branch of a Different Name appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

Git is one of those tools that I’ve always known just enough about to be dangerous, and usually tend to learn new skills when I’m in a position to truly need them. Shockingly enough it has taken me roughly 15 years of using git for me to encounter the need to push to a remote branch name whose name is different than my local branch. Of course, you can thank gh-pages for this occurrence.

Pushing to a remote branch of a different name than the local branch is as easy as a ::

# git push {remote} {local_branch_name}:{remote_branch_name}
git push origin gh-pages-wip:gh-pages

For the first time in my career I’m needing to push to the same branch, other than master, from multiple branches at one time. A sensitive branch like gh-pages will do that to you. Happy coding!

The post How to Push to a Git Remote Branch of a Different Name appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2021-02-09T12:13:17+00:00) How to Push to a Git Remote Branch of a Different Name. Retrieved from https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/

MLA
" » How to Push to a Git Remote Branch of a Different Name." David Walsh | Sciencx - Tuesday February 9, 2021, https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/
HARVARD
David Walsh | Sciencx Tuesday February 9, 2021 » How to Push to a Git Remote Branch of a Different Name., viewed ,<https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/>
VANCOUVER
David Walsh | Sciencx - » How to Push to a Git Remote Branch of a Different Name. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/
CHICAGO
" » How to Push to a Git Remote Branch of a Different Name." David Walsh | Sciencx - Accessed . https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/
IEEE
" » How to Push to a Git Remote Branch of a Different Name." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/. [Accessed: ]
rf:citation
» How to Push to a Git Remote Branch of a Different Name | David Walsh | Sciencx | https://www.scien.cx/2021/02/09/how-to-push-to-a-git-remote-branch-of-a-different-name/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.