@ -35,11 +35,10 @@ working tree to it; use "git checkout <newbranch>" to switch to the
@@ -35,11 +35,10 @@ working tree to it; use "git checkout <newbranch>" to switch to the
new branch.
When a local branch is started off a remote branch, git sets up the
branch so that linkgit:git-pull[1] will appropriately merge from that
remote branch. If this behavior is not desired, it is possible to
disable it using the global `branch.autosetupmerge` configuration
flag. That setting can be overridden by using the `--track`
and `--no-track` options.
branch so that linkgit:git-pull[1] will appropriately merge from
the remote branch. This behavior may be changed via the global
`branch.autosetupmerge` configuration flag. That setting can be
overridden by using the `--track` and `--no-track` options.
With a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.
If <oldbranch> had a corresponding reflog, it is renamed to match
@ -313,4 +313,28 @@ test_expect_success 'checkout specific path while in subdirectory' '
@@ -313,4 +313,28 @@ test_expect_success 'checkout specific path while in subdirectory' '
'
test_expect_success \
'checkout w/--track sets up tracking' '
git config branch.autosetupmerge false &&
git checkout master &&
git checkout --track -b track1 &&
test "$(git config branch.track1.remote)" &&
test "$(git config branch.track1.merge)"'
test_expect_success \
'checkout w/autosetupmerge=always sets up tracking' '
git config branch.autosetupmerge always &&
git checkout master &&
git checkout -b track2 &&
test "$(git config branch.track2.remote)" &&
test "$(git config branch.track2.merge)"
git config branch.autosetupmerge false'
test_expect_success \
'checkout w/--track from non-branch HEAD fails' '
git checkout -b delete-me master &&
rm .git/refs/heads/delete-me &&
test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&