{"id":75,"date":"2011-07-19T13:37:00","date_gmt":"2011-07-19T13:37:00","guid":{"rendered":"https:\/\/www.root42.de\/blog\/?p=75"},"modified":"2011-07-19T13:37:00","modified_gmt":"2011-07-19T13:37:00","slug":"switching-the-active-branch-in-a-bare-git-repository","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=75","title":{"rendered":"Switching the active branch in a bare git repository"},"content":{"rendered":"<p>If you ever need to delete the &#8220;active&#8221; branch in a git repository, you need to first switch the active branch. Because you cannot delete the branch you are sitting on&#8230; You cannot checkout a branch, as you would usually do. You have to change the symbolic reference called HEAD. You can do this with the symbolic-ref command:<\/p>\n<pre>$ git branch<br \/>* deletethis<br \/>  somebranch<br \/>$ git symbolic-ref HEAD refs\/heads\/somebranch<br \/>$ git branch<br \/>  deletethis<br \/>* somebranch<br \/>$ git branch -d deletethis<br \/><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you ever need to delete the &#8220;active&#8221; branch in a git repository, you need to first switch the active branch. Because you cannot delete the branch you are sitting on&#8230; You cannot checkout a branch, as you would usually do. You have to change the symbolic reference called HEAD. You can do this with &hellip; <a href=\"https:\/\/www.root42.de\/blog\/?p=75\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Switching the active branch in a bare git repository&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,49],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/75"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":0,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}