Reputation: 13
Pretty sure it's gone for good but need confirmation before I give up..
Local changes were not added yet. I was in the Git for Windows GUI, highlighted a couple lines, meant to hit 'Revert Lines', but hit 'Revert Hunk' instead. Poof goes the whole section.
Like I said, changes were not not added or stashed or anything, so nothing in reflog. Any other tricks, or do I start over?
Lesson learned: Add immediately, even if you want to clean things up before committing!
Upvotes: 1
Views: 48
Reputation: 164639
Like I said, changes were not not added or stashed or anything, so nothing in reflog. Any other tricks, or do I start over?
If they were never added, Git never stored the changes anywhere. Even if they were added, Git does not remember changes to the index. Sorry.
If this were done in an editor with Git integration, like VSCode or Atom, it's possible your editor could undo the change if you still had the file open. Check to see if your GUI has an undo.
Lesson learned: Add immediately, even if you want to clean things up before committing!
Yes, that's what the staging area is for: building the next commit. You can also commit and amend it later.
Upvotes: 1