diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-11-26 02:54:55 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-28 11:40:46 -0800 |
commit | 39bd6f726109942c6f77f59638f6763c9f00706c (patch) | |
tree | 903f5b34643ab93fa0a164a3962c70461b20406b /branch.c | |
parent | 3f59481e338c2d3167b9654a4289a9d1201f7944 (diff) | |
download | git-39bd6f726109942c6f77f59638f6763c9f00706c.tar.gz |
Allow checkout -B <current-branch> to update the current branchjn/branch-move-to-self
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 'branch.c')
-rw-r--r-- | branch.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -160,7 +160,8 @@ int validate_new_branchname(const char *name, struct strbuf *ref, void create_branch(const char *head, const char *name, const char *start_name, - int force, int reflog, enum branch_track track) + int force, int reflog, int clobber_head, + enum branch_track track) { struct ref_lock *lock = NULL; struct commit *commit; @@ -175,7 +176,8 @@ void create_branch(const char *head, explicit_tracking = 1; if (validate_new_branchname(name, &ref, force, - track == BRANCH_TRACK_OVERRIDE)) { + track == BRANCH_TRACK_OVERRIDE || + clobber_head)) { if (!force) dont_change_ref = 1; else |