From 237a6cf5489c1534bb0409d446a4a383e46fb67c Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Fri, 16 Jun 2023 12:35:54 +0200 Subject: [PATCH] add revert commit --- pages/git/revert-commit.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pages/git/revert-commit.md diff --git a/pages/git/revert-commit.md b/pages/git/revert-commit.md new file mode 100644 index 0000000..d42b1e2 --- /dev/null +++ b/pages/git/revert-commit.md @@ -0,0 +1,16 @@ +# Revert branch to commit + +Revert a branch to a certain commit, discarding newer ones. + +```bash +# Specific commit +git reset --hard a1d6424 + +# Commits back +git reset --hard HEAD@{3} +``` + +```bash +# Push +git push -f +```