Skip to content

Instantly share code, notes, and snippets.

@lnoering
Last active April 26, 2021 18:40
Show Gist options
  • Save lnoering/343547082624925898839244d7018105 to your computer and use it in GitHub Desktop.
Save lnoering/343547082624925898839244d7018105 to your computer and use it in GitHub Desktop.
Add remotes to the same project.

Working with more than one remotes at the same project.

Remote

Add new remote

Command: bash git add remote <name> <url>

Example: bash git remote add cloud git@github.com:lnoering/leon-m2.git

Fetch

You need make the fetch to the remote after add.

Command: bash git fetch <remote_name>

Example: bash git fetch cloud

Checkout

Get the branch from new remote.

Command: bash git checkout -b <branch_name> <remote_name/branch_name>

Example: bash git checkout -b cloud/staging-ded cloud/staging-ded

push

Push to the new remote.

Command: bash git push <remote> <local_branch_name:remote_branch_name>

Example: bash git push cloud cloud/staging-ded:staging-ded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment