This is an old revision of the document!


starting a new remote branch

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).

  • shared repo has one branch: master
  • user1 creates a branch called dev
    $ git push origin origin:refs/heads/dev
  • user1 now has the following branches locally:
    $ git branch -a
    
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/dev
      remotes/origin/master
  • user1 now must create a local branch which is set to “track” the new remote branch:
    $ git checkout --track -b dev origin/dev
    $ git branch -a
    
    * dev
      master
      remotes/origin/HEAD -> origin/master
      remotes/origin/dev
      remotes/origin/master
  • user2 can pull changes to see the new branch, then use the same command as user1 to create a local branch and track the remote branch:
    $ 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
  • docs/git/starting_a_new_remote_branch.1270399158.txt.gz
  • Last modified: 2010/04/04 10:39
  • by billh