Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 2/2] checkout (detached): truncate list of orphaned commits at the new HEAD

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:44

Johannes Sixt [off-list ref] writes:
When git checkout switches from a detached HEAD to any other commit, then
all orphaned commits were listed in a warning:

  Warning: you are leaving 2 commits behind...:

    a5e5396 another fixup
    6aa1af6 fixup foo

But if the new commit is actually one from this list (6aa1af6 in this
example), then the list in the warning can be truncated at the new HEAD,
because history beginning at HEAD is not "left behind". This makes it so.
If you did:

	git checkout master^0
        git commit --allow-empty -m emp0
        git commit --allow-empty -m emp1
        tip=$(git rev-parse HEAD)
        git reset --hard HEAD^

and then

	git checkout $tip

it used to warn about "emp0" but because you are checking out "emp1",
which is a descendant of "emp0", nothing is lost and no lossage is
reported with the updated code.

Makes sense; thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help