Information Technology Reference
In-Depth Information
remotes/origin/bar is a remote tracking branch and the second file .git/
refs/heads/foo is the local tracking branch. The local tracking branch foo is
connected with remote tracking branch origin/bar .
Hint You also can create the master branch that points to origin/master with
the $ git branch master origin/master command. I avoided the above
command because it not only creates a local master branch but also sets up tracking. I
prefer to split both operations. Therefore I used $ git rev-parse and $ git
branch --set-upstream-to to perform the two actions separately.
The last step of this procedure is to store the information about the default branch in
the remote repository locally:
$ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/
origin/master
This command will create a local file .git/refs/remotes/origin/HEAD .
The file will contain a symbolic reference pointing to refs/remotes/origin/
master . This is how we know which branch is considered default in the remote end.
Git allows direct manipulation of its configuration with the $ git config com-
mand. Therefore the command $ git branch --set-upstream-to=ori-
gin/bar issued in the foo branch is equivalent to two commands:
$ git config branch.foo.remote origin
$ git config branch.foo.merge refs/heads/bar
Using an additional --unset parameter you can also unset the arbitrary option. In
Recipe 10-5 we will use:
$ git config --unset branch.foo.remote
$ git config --unset branch.foo.merge
to unset tracking.
Search WWH ::




Custom Search