summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-11-26 08:54:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-28 19:40:46 (GMT)
commit39bd6f726109942c6f77f59638f6763c9f00706c (patch)
tree903f5b34643ab93fa0a164a3962c70461b20406b /t
parent3f59481e338c2d3167b9654a4289a9d1201f7944 (diff)
downloadgit-39bd6f726109942c6f77f59638f6763c9f00706c.zip
git-39bd6f726109942c6f77f59638f6763c9f00706c.tar.gz
git-39bd6f726109942c6f77f59638f6763c9f00706c.tar.bz2
Allow checkout -B <current-branch> to update the current branch
When on master, "git checkout -B master <commit>" is a more natural way to say "git reset --keep <commit>", which was originally invented for the exact purpose of moving to the named commit while keeping the local changes around. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t2018-checkout-branch.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 75874e8..2741262 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -189,12 +189,13 @@ test_expect_success 'checkout -b <describe>' '
test_cmp expect actual
'
-test_expect_success 'checkout -B to the current branch fails before merging' '
+test_expect_success 'checkout -B to the current branch works' '
git checkout branch1 &&
+ git checkout -B branch1-scratch &&
+
setup_dirty_mergeable &&
- git commit -mfooble &&
- test_must_fail git checkout -B branch1 initial &&
- test_must_fail test_dirty_mergeable
+ git checkout -B branch1-scratch initial &&
+ test_dirty_mergeable
'
test_done