Re: [PATCH] merge: allow "-" as a short-hand for "previous branch"

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] merge: allow "-" as a short-hand for "previous branch"

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:00

Thomas Adam [off-list ref] writes:
I agree this is is useful, but is there a danger of this being a
common typo, and people merging in previous branches a lot more often
than they ever intended?  In the case of "git checkout -" that's not
as fatal, but if I ever mistype "git merge -" -- I'm now left with an
unraveling exercise to do.
Just like you can checkout the previous branch back if you found you
checked out a wrong branch by a typo, if you found that you merged a wrong
branch, you can just reset it away back to ORIG_HEAD, no?

Or am I missing something more obvious?

Re: [PATCH] merge: allow "-" as a short-hand for "previous branch"

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:51:00

Junio C Hamano venit, vidit, dixit 08.04.2011 01:26:
Thomas Adam [off-list ref] writes:
quoted
I agree this is is useful, but is there a danger of this being a
common typo, and people merging in previous branches a lot more often
than they ever intended?  In the case of "git checkout -" that's not
as fatal, but if I ever mistype "git merge -" -- I'm now left with an
unraveling exercise to do.
Just like you can checkout the previous branch back if you found you
checked out a wrong branch by a typo, if you found that you merged a wrong
branch, you can just reset it away back to ORIG_HEAD, no?

Or am I missing something more obvious?
Only tests and doc :)

Seriously, I like that. If there are more places where this makes sense
(I haven't looked) we might even factor it out. In principle it makes
sense everywhere where a branch name makes sense, e.g.:

git branch -D foo
#...can't delete the current branch
git checkout whatever
git branch -D -

In this case, shell history is faster, of course.

Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help