Difference between revisions of "Git Snippet: Revert"

From Coder Merlin
(Created page with "== Revert to Tag == <syntaxhighlight lang="bash"> git checkout 1.1.1 git diff master > ~/diff.patch git checkout master cat ~/diff.patch | git apply git commit -am 'Rolled b...")
 
Line 1: Line 1:
== Revert to Tag ==
== Revert to Tag ==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git checkout 1.1.1
git checkout 1.1.1
Line 12: Line 10:


Reference: [https://stackoverflow.com/questions/6872223/how-do-i-revert-master-branch-to-a-tag-in-git/6872462 (Stack Overflow)]
Reference: [https://stackoverflow.com/questions/6872223/how-do-i-revert-master-branch-to-a-tag-in-git/6872462 (Stack Overflow)]
== Revert to Commit ==
<syntaxhighlight>
git checkout -f 2599172 -- .
git commit -a
</syntaxhighlight>

Revision as of 16:00, 4 February 2020

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Revert to Tag[edit]

git checkout 1.1.1
git diff master > ~/diff.patch
git checkout master
cat ~/diff.patch | git apply
git commit -am 'Rolled back to version 1.1.1'
git push origin master

Reference: (Stack Overflow)

Revert to Commit[edit]

git checkout -f 2599172 -- .
git commit -a