Post

Git Remote Cheatsheet

Add a Remote:

1
git remote add <name> <url>

List Remotes:

1
2
git remote -v

Rename a Remote:

1
2
git remote rename <old_name> <new_name>

Remove a Remote:

1
git remote rm <name>

Show Remote URL:

1
2
git remote get-url <name>

Set Remote URL:

1
2
git remote set-url <name> <new_url>

Fetch Changes from a Remote:

1
2
git fetch <remote_name>

Push Changes to a Remote:

1
2
git push <remote_name> <branch_name>

Pull Changes from a Remote:

1
2
git pull <remote_name> <branch_name>

Show Remote Branches:

1
2
git branch -r

Track a Remote Branch:

1
2
git checkout -t <remote_name>/<branch_name>

Delete a Remote Branch Locally:

1
2
git branch -d <branch_name>

Delete a Remote Branch:

1
2
git push <remote_name> --delete <branch_name>

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.