Skip to content

The archive for related commands.

metasmile edited this page Aug 31, 2016 · 2 revisions

Restore uncommitted changes after hard reset

git fsck --cache --unreachable $(git for-each-ref --format="%(objectname)") | cut -d ' ' -f3 | xargs git show > uncommitted

Restore a commit after hard reset. It's only valid to restore just previous action

git reset --hard $(git reflog |  cut -d ' ' -f1 | sed ‘2!d’) 
Clone this wiki locally