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

Publikováno: 9.2.2021

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.

Celý článek

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.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace