Create new local branch from remote branch (origin)
git checkout -b <local-branch-name> --track <origin/remote-branch-name>
- example:
git checkout -b dev --track origin/dev
Fetch latest changes from remote branch without checking out of local branch
git fetch origin <remote-branch>:<local-branch>
- Example: fetch latest remote
prod
branch into localprod
branch while working in a separate branchfeature/my-feature-branch
then
# fetch origin
git fetch origin prod:prod
# merging into my current feature branch
git merge prod