How to push branches to a git remote using Terminal

A step by step guide on pushing all your branches to new git remote using Terminal.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 06/04/2023 at 15:47
Last Updated on 06/04/2023 at 17:02
A flower that represents Github with the text "Push all branches to a remote" beneath it.

A step by step guide on pushing all your branches to new git remote using Terminal.

Subscribe

Step One: Set the current directory

A screenshot of Terminal showing you how to set the current directory.

Open Terminal, and set the current directory to that of your project using a command similar to the one below.

cd path/to/your/project

Step Two: Get all branches

A screenshot of Terminal showing you how to get all branches.

Run the following line in Terminal to fetch and pull all the branches

git fetch --all; git pull --all

Step Three: Push all the branches to remote

A screenshot of Terminal showing you how to push all the branches to a new git remote.

Push all the branches to your new remote by running the line below in Terminal.

git push -u [REMOTE_NAME] --all; git push -u [REMOTE_NAME] --tags

Please ensure that you replace REMOTE_NAME with the name of your Git remote.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe