git pull remote branch code example

Example 1: delete remote git branch

git push --delete remoteName branchName

Example 2: git fetch all remote branch

# track all remote branches:
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# update all local copies of remote branches
git fetch --all
# update all local tracking branches
git pull --all

Example 3: pull remote branches

git fetch origin
git checkout --track origin/<remote_branch_name>

Example 4: git bash upstream branch change

git branch --set-upstream-to=origin/branch

Example 5: git checkout to remote branch

$ git checkout --track origin/newsletter
Branch newsletter set up to track remote branch newsletter from origin.
Switched to a new branch 'newsletter'

Example 6: git pull on another branch

git fetch origin master:master

Tags:

Html Example