[BUG] rebase --interactive silently overwrites ignored files
- Date: Thu, 11 Apr 2019 16:56:09 -0700
- From: wh <microrffr@xxxxxxxxx>
- Subject: [BUG] rebase --interactive silently overwrites ignored files
I'm using git 2.20.1 from Debian. Git is usually careful not to
overwrite untracked files, including ignored files. But interactive
rebase doesn't detect this (non-interactive rebase works fine).
echo 1 >feature-1
git add feature-1
git commit -m "feature 1"
git clone upstream local
# write some tools for our own convenience
echo ours >tools
echo /tools >>.git/info/exclude
# start working on a feature
git checkout -b f2
echo wip >feature-2
git add feature-2
git commit -m "wip"
# official tools are available
echo theirs >tools
git add tools
git commit -m "tools"
git fetch ../upstream master
# this would be okay
#git rebase FETCH_HEAD
# problem: overwrites tools silently
GIT_EDITOR=true git rebase -i FETCH_HEAD
Expected: `git rebase -i` fails because it would have to overwrite the
untracked "tools" file. Contents of tools file remains `ours`.
Actual: Contents of tools file becomes `theirs`.