{"id":31,"date":"2013-03-23T19:16:00","date_gmt":"2013-03-23T18:16:00","guid":{"rendered":"http:\/\/www.hauweele.net\/~gawen\/blog\/?p=31"},"modified":"2014-05-12T19:40:36","modified_gmt":"2014-05-12T17:40:36","slug":"omg-i-just-pushed-the-wrong-branch","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=31","title":{"rendered":"OMG! I just pushed the wrong branch&#8230;"},"content":{"rendered":"<p>Today I&#8217;ve done a lot of rebasing with a series of patches that I needed to push to the master branch of some project. The patches originated from a branch named <i>injector<\/i>&nbsp;and I prepared the merge in another branch named <i>injector-merge<\/i>. When it came time to merge my branch back into master I should have written :<\/p>\n<pre>git merge injector-merge<\/pre>\n<p>But instead I wrote :<\/p>\n<pre>git merge injector<\/pre>\n<p>Damned auto completion ! Huh&#8230; That wouldn&#8217;t be so bad if only I hadn&#8217;t pushed that to upstream too&#8230; So I had to get rid of my master branch and replace it upstream as quickly as possible before anybody could clone or pull from it. By chance this is a fairly new project and I guess nobody cloned or pulled in such a short amount of time (this whole thing lasted no more than one minute or so). So I moved my master branch and replaced it with the injector-merge branch and pushed-force everything.<\/p>\n<pre>git checkout master<br \/>git branch -m oldmaster<br \/>git branch -m injector-merge master<br \/>git log<br \/><\/pre>\n<p>Hum&#8230; Everything seems to be in order! Now push it back! <\/p>\n<pre>git push -f origin master<\/pre>\n<p>No complaining so far? Right! Well from now on I will call the merge branches merge-* instead of *-merge.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I&#8217;ve done a lot of rebasing with a series of patches that I needed to push to the master branch of some project. The patches originated from a branch named injector&nbsp;and I prepared the merge in another branch named &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=31\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[135,137,134,133,139,136,138,132],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-branch","tag-force","tag-git","tag-merge","tag-push","tag-rebase","tag-upstream","tag-wrong"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}