git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] rebase --interactive silently overwrites ignored files

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Apr 12, 2019, 16:30 UTC
Message-ID
<2643a200-5356-f3bc-1715-3f34b5f19a5b@gmail.com>
In-Reply-To
<CAL_tzDGRQ4BzJ4c6QypXfBXQNQYocbKbJSBOHhBBB2TwQQPCGA@mail.gmail.com>
Hi
On 12/04/2019 00:56, wh wrote:
> I'm using git 2.20.1 from Debian. Git is usually careful not to
> overwrite untracked files, including ignored files.

Git normally overwrites ignored files, so I think in your example rebase -i is working as expected, I'm surprised that the am based rebase does not overwrite the ignored file. There has been some discussion about introducing 'precious' files that are ignored but protected in the same way as untracked files [1].

Best Wishes
Phillip
[1] https://public-inbox.org/git/20190409102649.22115-1-pclouds@gmail.com/
  But interactive
Show 49 quoted lines
> rebase doesn't detect this (non-interactive rebase works fine).
> 
> Reproduction:
> -----
> 
> #!/bin/sh
> mkdir upstream
> cd upstream
> git init
> echo 1 >feature-1
> git add feature-1
> git commit -m "feature 1"
> 
> cd ..
> git clone upstream local
> cd 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"
> 
> cd ../upstream
> # official tools are available
> echo theirs >tools
> git add tools
> git commit -m "tools"
> 
> cd ../local
> git fetch ../upstream master
> 
> # this would be okay
> #git rebase FETCH_HEAD
> 
> # problem: overwrites tools silently
> GIT_EDITOR=true git rebase -i FETCH_HEAD
> 
> cat tools
> 
> -----
> 
> 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`.
> 
Previous: whNext: wh
Message 2 of 8 in “[BUG] rebase --interactive silently overwrites ignored files”
  1. whApr 11, 2019
  2. Phillip WoodApr 12, 2019
  3. whApr 14, 2019
  4. Phillip WoodApr 14, 2019
  5. Phillip WoodMay 2, 2019
  6. Duy NguyenMay 2, 2019
  7. Junio C HamanoMay 5, 2019
  8. Phillip WoodMay 7, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.