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

Re: Better cooperation between checkouts and stashing

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

Michael Witten [off-list ref] writes:
..., I think you essentially want to implement
"git checkout" with something like the following (this hack is **not**
meant as a solution; it is only meant to illustrate what I think is
Markus Elfring's desire):
Your "checkout" needs a bit better error checking.  For example, you don't
want to "reset --hard" when stash failed for whatever reason.

For performance and cleanliness reasons, it should first try a branch
switch, and only after seeing it fail due to local changes, perform your
stash-unstash magic.  You would probably want to use the usual "stash
save", as you will be consuming the stashed change yourself as its first
user, and "pop" will clear it if things resolve cleanly, or the stash will
be left as the first element to make it easy to re-attempt the conflict
resolution.  No need for stash-id nor special casing of detached HEAD
situation.

And it should do all that only under "-m" option, i.e. when the user
indicated that s/he is willilng to face conflict resolution while
switching.  That would be a genuine improvement compared to the current
system (and I suspect it would be easier to implement).  "checkout -m" so
far has been as bad as "CVS/SVN update" in that it can get you into an
unresolvable mess without a chance to go back and retry.  autostash will
remedy that.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help