git remote
List Remote
git remote [-v|--verbose]
Add a Remote
git remote add <name> <url>
Remove a Remote
git remote rm|remove <name>
Rename a Remote
git remote rename <old-name> <new-name>
Get Remote URLs
git remote get-url <name>
Set Remote URLs
git remote set-url <name> <url>
Fetch From Remote
git fetch
Speficify remote repo and/or branch:
git fetch <remote=origin> <branch=master>
Pull From Remote
git pull
= git fetch
+ git merge
git pull
Speficify remote repo and/or branch:
git pull <remote=origin> <branch=master>
Push To Remote
Default Action
git push
Configure default action:
git config push.default simple
simple
: pushes the current branch with the same name on the remote. (default)upstream
: push the current branch back to the branch whose changes are usually integrated into the current branch. (for central workflow)current
: push the current branch to update a branch with the same name on the receiving end. (for central and non-centra workflows)nothing
: do not push anything (error out) unless a refspec is given. This is primarily meant for people who want to avoid mistakes by always being explicit.matching
: push all branches having the same name on both ends.
Speficify Repo/Branch
git push <remote=origin> <branch=master>
Force to Push
Disable checks:
git push -f|--force <remote=origin> <branch=master>
Delete Remote Branch
git push [-f] <remote-repo> :<remote-branch>