snipt

Ctrl+h for KB shortcuts

Text only

Git revert to previous commit

1
2
3
4
# Check the log to get the hash
git log --oneline

git reset --hard <hash>
https://snipt.net/embed/31a8fbd4a05e38940ca39a079524ee64/
/raw/31a8fbd4a05e38940ca39a079524ee64/
31a8fbd4a05e38940ca39a079524ee64
text
Text only
5
2024-05-08T18:20:47
True
False
False
Sep 24, 2021 at 01:16 PM
/api/public/snipt/118/
git-revert-to-previous-commit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a># Check the log to get the hash </span><span id="L-2"><a name="L-2"></a>git log --oneline </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>git reset --hard &lt;hash&gt; </span></pre></div> </td></tr></table>
git
1
2
3
4
5
6
7
--- 
+++ 
@@ -0,0 +1,4 @@
+# Check the log to get the hash
+git log --oneline
+
+git reset --hard <hash>