Reputation: 9880
Switched directories, though a bunch of other changes were on another branch, rm -r the entire app/ directory, now I'm screwed.
https://github.com/GeerSwitch/penbuilders/commit/20c5111364f0c8369669d2347d35f4b83371e6fb
See that branch there? See the 2k+ deletions? I suck at git.
I've tried resetting the head, resetting to previous commit hashes, and still, those files aren't back.
Can someone save me? ls-files --deleted shows nothing, I can see them in the link above, and will copy+paste if I have to.
Upvotes: 0
Views: 46
Reputation: 8956
The files are still there, short of wiping your entire GitHub repository you can always get them back. You could try a git revert
:
git revert 20c51
This will create a new commit that reverses all the changes in commit 20c51
. This is the safest approach since it does not rewrite any of the existing history. It's also the preferred approach if you are working with any collaborators.
On the other hand, if you want to "play with fire" you can do a git rebase --interactive 20c51~1
and then edit
the offending commit(s). This will alter the history and can cause you to lose your existing work if not used carefully.
Upvotes: 1
Reputation: 83527
You can restore to the previous commit with git reset --hard a1b043b
.
Note: git reset --hard must be used very carefully: it will completely wipe your local changes and will alter the location of the current branch. Also, if you are collaborating with other developers, it will cause problems if someone else has based work off of the branch you are resetting.
Upvotes: 0