"git reset --hard HEAD" after "git commit --amend" -



"git reset --hard HEAD" after "git commit --amend" -

i performed git commit --amend.

i made changes, wanted discard them, performed git reset --hard head, thinking go point amended. seems have gone point of original commit.

there numerous answers undoing git reset --hard head on here, none deal undoing reset in situation (with amend involved), , wanted create sure should follow same pattern before proceeding.

this seems popular answer: undoing git reset --hard head~1

edit

you know what, i'm realizing i've done couple of --amends today without first doing git add together .. crappy day. there way work if didn't git add together .?

if git commit --amend involved content modification (git add), git reset --hard have worked expected.

but git commit --amend without modification modify commit date (hence changing/sha1 commit sha1)

if changes added, this answer shows git fsck should able show changes.

a more finish command (in this answer) be:

git fsck --cache --no-reflogs --lost-found --unreachable head

more @ "recovering added file after doing git reset --hard head^".

git

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -