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

git-rebase --abort eats files

From
MMadhu <enometh@meer.net>
Date
Jun 26, 2010, 12:53 UTC
Message-ID
<20100626125924.160F11F212@leonis4.robolove.meer.net>

Don't know if this has been resolved-by-debate here before, But adding a file via git-add in the middle of an interactive rebase and aborting the rebase deletes the hitherto untracked file. It should not.

rm -rfv /tmp/t1 ; mkdir -pv /tmp/t1 cd /tmp/t1 && git-init-db cd /tmp/t1 && touch file1 file2 file3 cd /tmp/t1 && git-add file1 cd /tmp/t1 && git-commit -m "Explet1" file1 cd /tmp/t1 && git-add file2 cd /tmp/t1 && git-commit -m "Explet2" file2 cd /tmp/t1 && git-rebase --abort cd /tmp/t1 && EDITOR="sed -i -e 's/^pick/edit/'" git rebase -i 'HEAD^' cd /tmp/t1 && git-add file3 cd /tmp/t1 && git-status cd /tmp/t1 && git-rebase --abort test -e /tmp/t1/file3 || echo bwaaah

Maybe something like this to fix it?
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 436b7f5..2702536 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -749,6 +749,7 @@ first and then run 'git rebase --continue' again."
                        git symbolic-ref HEAD $HEADNAME
                        ;;
                esac &&
+               git-reset &&
                output git reset --hard $HEAD &&
                rm -rf "$DOTEST"
                exit

--
Madhu
Next: Johannes Sixt
Message 1 of 6 in “git-rebase --abort eats files”
  1. MadhuJun 26, 2010
  2. Johannes SixtJun 26, 2010
  3. Ramkumar RamachandraJun 28, 2010
  4. MadhuJun 29, 2010
  5. Pete HarlanJun 29, 2010
  6. git-rebase --continue eats commitsMadhu, Aug 31, 2013

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.