How to push branches to a git remote using Terminal

Oscar de la Hera Gomez
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.

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.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details