From: Nguyen Thai Ngoc Duy Date: Tue, 28 Sep 2010 05:47:50 GMT Subject: Re: [PATCH] checkout: do not switch branch during a rebase unless -f is given Message-ID: In-Reply-To: 2010/9/28 Jonathan Nieder : > (+cc: Frédéric, Dscho, Christian) > > Nguyễn Thái Ngọc Duy wrote: > >> It does not make much sense to switch branch when you are in a middle >> of a rebase. Sometimes you might want to switch away for a moment then >> back with "git checkout - ". But I find myself so many times switching >> away then forget that I was rebasing something. >> >> Avoid doing that by default. Users can use -f if they really want to. > > Nice! But I worry is that scripts that use "git checkout" porcelain > during a rebase would be broken. Right. I used git-rebase from my installation, the new "git checkout" from worktree and missed that as a result. > Even rebase --interactive uses checkout from time to time: > >  - for preserving merges >  - to move to the correct branch in response to "git rebase -i > " >  - to move to the target in "git rebase -i --onto " > > Unfortunately I do not have any good advice. Would it make sense to > >  - first, change these call sites in git to use checkout -f >  - teach checkout to warn (without erroring out) to give people time > to change their scripts >  - warn loudly about the upcoming change in the release notes >  - later, change checkout to error out when -f is not supplied > > or am I being too paranoid? No. But I don't like the idea of making scripts use "checkout -f". My intention was to stop users from doing that, not scripts. Putting "-f" everywhere might have more negative side effects. Maybe adding "--porcelain" to checkout first, updating scripts to use it, then only check for rebase/bisect/am when --porcelain is missing. -- Duy