Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: git-checkout silently throws away the dirty status of index without a warning?

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

Tzu-Jung Lee [off-list ref] writes:
Is this an intended behavior?
Yes, I think you are talking about the case where "the current index does
not match the current HEAD, but it does match the tree we are switching
to" case. In that case we take the contents of switched-to branch.

It is the last case in the table in this old design document:

    http://thread.gmane.org/gmane.comp.version-control.git/4641

bug ignore the terminology (stage#). Read only the body of the table, with
the understanding that the three entries in each row talk about the state
for the same path in the index entry, the tree entry in the current HEAD,
and the tree entry in the switched-to branch. Also the table does not talk
about the checking performed on the working tree file, but assume that we
do not overwrite it when the resulting entry in the index does not match
what you have there.

The reason we allow branch switching in this case, instead of failing, is
so that you can be in a state where you applied the same change (relative
to the current branch to the branch you are switching to) lying around
already in your workspace and safely switch to the new branch without
losing any work (after all, the content matches).

By the way, the first six lines of your original message that describes
"saving and applying" is not correct.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help