{"id":4080,"date":"2015-06-23T09:49:00","date_gmt":"2015-06-23T13:49:00","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=4080"},"modified":"2015-06-23T09:49:41","modified_gmt":"2015-06-23T13:49:41","slug":"undoing-git-actions","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=4080","title":{"rendered":"Undoing Git Actions"},"content":{"rendered":"<p> Git is a wonderful thing and despite its reputation for being really hard to use, is easy to understand and use for <i>the usual cases<\/i>. The problems occur when you make a mistake and the easy mental model you have of Git doesn&#8217;t tell you how to recover. <\/p>\n<p> Over at the GitHub Blog, <a href=\"https:\/\/github.com\/jaw6\">Joshua Wehner<\/a> has an excellent post on how to <a href=\"https:\/\/github.com\/blog\/2019-how-to-undo-almost-anything-with-git\">recover from common Git user errors<\/a>. By \u201cerror\u201d he means some action that you wish to undo even though the action itself was legal. Even with a good mental model of how Git works, many of these recoveries are not obvious so it&#8217;s well worth your time to read through the post. <\/p>\n<p> It&#8217;s valuable enough that I bookmarked it because when I do one of those things, I can never remember how to recover. For example, I learned how to start ignoring some files even though I had already started tracking them. You might think that just adding them to the <code>.gitignore<\/code> file would do the trick but it doesn&#8217;t. It&#8217;s easy to fix this problem but it certainly isn&#8217;t obvious. Take a look at Wehner&#8217;s post to find out how. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git is a wonderful thing and despite its reputation for being really hard to use, is easy to understand and use for the usual cases. The problems occur when you make a mistake and the easy mental model you have &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=4080\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[23],"class_list":["post-4080","post","type-post","status-publish","format-standard","hentry","category-general","tag-git"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4080"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4080\/revisions"}],"predecessor-version":[{"id":4081,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4080\/revisions\/4081"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}