On Fri, Sep 14, 2007 at 22:51:29 -0400, Shawn O. Pearce wrote: > It isn't unreasonable to want Git to save uncommitted work for the > current branch and then you switch to another, ending up with a > clean working directory when you finally get there. Today we have > git-stash to help you with this, but I'm thinking maybe we want to > connect git-checkout with it? I think it would be reasonable if it just forced you to decide about it. That is reading the documentation, checkout only switches branches if the merge of each modified file is trivial and only does 3-way merge if it got -m option. It might be reasonable to requre that option for all cases, where there are local changes and the branches don't point to the same commit and without it, checkout should say something like: Cannot switch branches, because the tree is modified. You can apply the modifications to the target branch by using -m option, or commit them before switching branches (you can undo or amend that commit later if it's not finished yet). The case with branches pointing to the same commit is for checkout -b, reverting that command if you do it too early/by mistake/wanted branch instead and for doing it with branch + checkout. -- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature