Revert to previous commit

Go to previous commit without saving changes.

git reset --hard HEAD

with HEAD is the last commit in your current branch

Revert to a older commit

# Get the commit code first with
git log

#Then use it to do a reset
git reset commit_code_here 

# Move pointer to that head
git reset --soft HEAD@{1}

git commit -m "Reverting a potential stupidity"

# Apply changes
git reset --hard

# Git push everything
git push 

Discover more from Humberto Ramos, PhD

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending

Discover more from Humberto Ramos, PhD

Subscribe now to keep reading and get access to the full archive.

Continue reading