From 6962e53f8127e411506245d3404c383c42407963 Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Fri, 12 Jan 2024 05:08:29 -0800 Subject: [PATCH] :memo: Made a note on how to properly revert in git --- git_basics.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/git_basics.txt b/git_basics.txt index ccb07b7a..8191cf0f 100644 --- a/git_basics.txt +++ b/git_basics.txt @@ -126,5 +126,22 @@ Once within your local repository directory you can view what repositories you h git remote -v +################### REVERTING BACK TO PREVIOUS COMMIT ##################### + +NOTE: this is kinda dangerous, be careful, especially when working in production or with others + +git log + +- Find log hash of the commit you want to revert to + +git revert --no-commit 0d1d7fc3..HEAD + +NOTE: the '..HEAD' syntax is necessary + +git commit + +git push origin main + +This will revert it back to the previous commit