diff options
author | Junio C Hamano <junkio@cox.net> | 2006-04-02 16:25:01 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-04-02 22:22:27 -0700 |
commit | c72112e6e1593bd77132a815ba484d0ff880a7b4 (patch) | |
tree | 02a0b232638adab9f100e84f6165600afc77747e /git-resolve.sh | |
parent | 40e907bff260a94306b1fe43d0fb829bf54e3103 (diff) | |
download | git-c72112e6e1593bd77132a815ba484d0ff880a7b4.tar.gz git-c72112e6e1593bd77132a815ba484d0ff880a7b4.tar.xz |
git-clone: fix handling of upsteram whose HEAD does not point at master.
When cloning from a remote repository that has master, main, and
origin branches _and_ with the HEAD pointing at main branch, we
did quite confused things during clone. So this cleans things
up. The behaviour is a bit different between separate remotes/
layout and the mixed branches layout.
The newer layout with $GIT_DIR/refs/remotes/$origin/, things are
simpler and more transparent:
- remote branches are copied to refs/remotes/$origin/.
- HEAD points at the branch with the same name as the remote
HEAD points at, and starts at where the remote HEAD points at.
- $GIT_DIR/remotes/$origin file is set up to fetch all remote
branches, and merge the branch HEAD pointed at at the time of
the cloning.
Everything-in-refs/heads layout was the more confused one, but
cleaned up like this:
- remote branches are copied to refs/heads, but the branch
"$origin" is not copied, instead a copy of the branch the
remote HEAD points at is created there.
- HEAD points at the branch with the same name as the remote
HEAD points at, and starts at where the remote HEAD points at.
- $GIT_DIR/remotes/$origin file is set up to fetch all remote
branches except "$origin", and merge the branch HEAD pointed
at at the time of the cloning.
With this, the remote has master, main and origin, and its HEAD
points at main, you could:
git clone $URL --origin upstream
to use refs/heads/upstream as the tracking branch for remote
"main", and your primary working branch will also be "main".
"master" and "origin" are used to track the corresponding remote
branches and with this setup they do not have any special meaning.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-resolve.sh')
0 files changed, 0 insertions, 0 deletions