New files added during git interactive redirection, rebase interrupted, no new files

I did git rebase -i to commit multiple nodes before. I have added some new files that I would like to add to this commit.

It looks like I was mistaken for node, so I immediately executed git rebase-abort. These new files have completely disappeared. In reflogs it looks like a delete command (remote file mode 100644), but even the file name is missing.

This does not look good, but I decided that I would ask - can this be restored?

+5
git
Oct 17 2018-11-11T00:
source share
2 answers

No, the changes were not โ€œrecoverableโ€, as they could be captured by one team. Yes, the changes were found in git fsck, as well as 100 other old changes that I had to sort. Ick, but better than a total loss.

It is important to note: - As soon as you do "git add", the commit is written to the node - things cannot be completely lost from this point - "git rebase abort" is not like a transaction cancellation, it is more like "git reset --hard", which will delete all new files that were added during this reboot. git does not track what changes you made during your reboot, so it cannot undo them or push them back. During rebase, you are in a zone without a person, and a rebase interrupt is a git reset back to the previous commit node.

To summarize the problem, I made several changes and organized them into separate commits, 1 function per commit. Halfway, I realized that I missed some files on an earlier (unchecked) commit. I made a git tag, started an interactive reboot, made a git pop-up message, added the missing files to the previous commit, and realized that I added new files to the wrong commit node. Then I did git rebase-abort, which deleted these new files and was usually terrible.

TL; DR: do not add new files during the interactive redirection without their first support - if you cancel rebase, your files will be (mostly) lost and will not be easily restored.

+3
Oct 27 '11 at 19:36
source share

Since files were never added to the DAG, this does not look like recovery unless you have a second copy. However, if you add them to the index, you can find them, as @jefromi suggests, git fsck --lost-found .

Additional Information:

Looking at the reflog will show you where your industry pointed. You want to use git log for the actual story. Add the --stat option to see file changes with each commit.

+1
Oct 17 2018-11-23T00:
source share



All Articles