In the examples below, there is a shared repo (shared), a user1 (doing the branch changes), and a user2 (needs to pull the branch changes).
Method 1 may be better for you if the branch already exists locally, and you need that history pushed to the shared repo.
$ git checkout -b dev
$ git push origin dev
git branch --set-upstream dev origin/dev (output should be: Branch dev set up to track remote branch dev from origin.)
$ git checkout master $ git branch -D dev $ git checkout --track -b dev origin/dev
[branch "dev"] remote = origin merge = refs/heads/dev
$ git pull From /path/to/shared/repo * [new branch] dev -> origin/dev Already up-to-date. $ git checkout --track -b dev origin/dev $ git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
$ git push origin origin:refs/heads/dev
$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
$ git checkout --track -b dev origin/dev $ git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
$ git pull From /path/to/shared/repo * [new branch] dev -> origin/dev Already up-to-date. $ git checkout --track -b dev origin/dev $ git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
we want to create a new remote branch called foo2 from an existing remote branch called foo
$ git push origin origin/foo:refs/heads/foo2
git push origin :old_branch_to_be_deleted