Re: Bug with .gitignore and branch switching
- Date: Fri, 17 Mar 2017 14:58:48 -0700
- From: Stefan Beller <sbeller@xxxxxxxxxx>
- Subject: Re: Bug with .gitignore and branch switching
On Fri, Mar 17, 2017 at 2:23 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> We've discussed the lack of "untracked but precious" class a few
> times on the list in the past, but I do not recall the topic came up
> in the recent past. It perhaps is because nobody found that class
> useful enough so far.
My gut reaction on reading the bug report was that the root cause is
git-checkout doing the wrong thing by default. (cf. Git-Merge-2017,
"What’s Wrong With Git?", I am not sure if the video is yet available)
One argument in that talk was that Git promises to do "work on multiple
branches in parallel (context-switched, single threaded)", and git-checkout
is the apparent command to switch to another context (branch).
However by putting away only tracked content, we miss
doing a proper context switch for untracked and ignored files.
That partial switch has advantages in the typical use case, e.g.
* compiled objects in the worktree may not need to be recompiled.
* no need to do work for the untracked files (e.g. move to a special
Both these reasons argue for performance, instead of "correctness"
in the sense of "easy-to-understand commands for top level principles".
And in that talk the presenter concluded that git-stash was only invented
to circumvent these "correctness" problems, such that if git-checkout
were to also (de)populate the untracked and ignored files on branch
switch we would not need git-stash, because git-checkout did it for you
already. And by the omission of git-stash and an apparent
easier-to-understand git-checkout the whole git suite would become
easier for users.
I further conclude that when git-checkout were to behave "correct" as
outlined above, then this class of bug reports would not occur.
Just food for thought.