Re: git-pull-script on my linus tree fails..

Linus Torvalds
2005-06-22T01:16:28Z

On Tue, 21 Jun 2005, Jeff Garzik wrote:
>
> git-checkout-script is now switching branches correctly :)

Goodie.

> Now stay tuned for my next email, where I demonstrate how to reproduce
> git-prune-script eating data :)

Before you demonstrate that, let me give you a quick warning on a very
useful but also very peculiar and perhaps baffling feature of my version
of "git checkout" as opposed to your "git switch".

In particular, think about what happens when you have changes in your
working directory, and you use "git checkout <newbranch>" (that is,
without the "-f" flag).

Now, if those changes actually _clash_ with the difference in the branch
you're switching to, you'll get an error (something like "Entry 'filename'
not uptodate. Cannot merge."). But if you have only edited files that are
the _same_ in both branches, then when you switch branches, those edits
will literally _follow_ you into the new branch.

Before, with your "git switch" script, any pending dirty state just got
thrown away.

Now, I'm convinced this is actually exactly the behaviour you want, but I
thought I'd mention it before you notice it on your own and get confused.

And hey, if you don't like the feature, you can always just use the "-f"
flag, which will act the way your old script did, and always just throw
any pending changes away when you check out a new branch.

Linus