{"id":211,"date":"2018-03-27T08:30:01","date_gmt":"2018-03-26T19:30:01","guid":{"rendered":"https:\/\/content.ronella.xyz\/apps\/wordpress\/?p=211"},"modified":"2018-03-27T09:43:15","modified_gmt":"2018-03-26T20:43:15","slug":"resetting-github-forked-master-with-upstream-master-branch","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=211","title":{"rendered":"Resetting GitHub Forked Master with Upstream Master Branch"},"content":{"rendered":"<p>If your GitHub forked master branch is ahead from the upstream's master branch\u00a0and you wanted to make it even <em>(i.e. also lose some work)<\/em>. The following procedure might help you.<\/p>\n<p><em>Note: If you have your default branch protected perform steps 1, 2, 3, 7, 8 and 9.\u00a0 Otherwise just do steps 4, 5 and 6.<\/em><\/p>\n<ol>\n<li>Open a terminal <em>(i.e. powershell, cmd, bash)<\/em> and checkout the master of the upstream to a temporary branch <em>(i.e. this could be anything)<\/em> using the following syntax:\n<pre>git checkout -b &lt;temporary-branch&gt; upstream\/master<\/pre>\n<p>Example<\/p>\n<pre>git checkout -b temp-branch upstream\/master<\/pre>\n<p><em>Where &lt;temporary-branch&gt; is\u00a0temp-branch.<\/em><\/li>\n<li>Push the temporary-branch to your origin using the following syntax:\n<pre>git push origin &lt;temporary-branch&gt;<\/pre>\n<p>Example<\/p>\n<pre>git push origin temp-branch<\/pre>\n<p><em>Using the &lt;temporary-branch&gt; from the example in step 1.<\/em><\/li>\n<li>On your browser, access your forked GitHub project and update the default branch to your temporary-branch.<a href=\"https:\/\/www.ronella.xyz\/wordpress\/wp-content\/uploads\/2018\/03\/reset-github-default-branch.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-216\" src=\"https:\/\/www.ronella.xyz\/wordpress\/wp-content\/uploads\/2018\/03\/reset-github-default-branch.png\" alt=\"\" width=\"989\" height=\"498\" \/><\/a><\/li>\n<li>On your terminal <em>(i.e. powershell, cmd, bash)<\/em>, switch to your master branch using the following command:\n<pre>git checkout master<\/pre>\n<\/li>\n<li>Reset the master based on the upstream's master branch using the following command:\n<pre>git reset --hard upstream\/master<\/pre>\n<\/li>\n<li>Push the update to your master using the following command:\n<pre>git push origin master --force<\/pre>\n<p><em>Note: If you didn't do step 3 this and the branch is proctected command will fail.<\/em><\/li>\n<li>On your browser, access your forked GitHub project and update the default branch to master.<a href=\"https:\/\/www.ronella.xyz\/wordpress\/wp-content\/uploads\/2018\/03\/reset-github-default-master.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-217\" src=\"https:\/\/www.ronella.xyz\/wordpress\/wp-content\/uploads\/2018\/03\/reset-github-default-master.png\" alt=\"\" width=\"990\" height=\"490\" \/><\/a><\/li>\n<li>Going back to your terminal, delete the local temporary-branch using the following syntax:\n<pre>git branch -D &lt;temporary-branch&gt;<\/pre>\n<p>Example<\/p>\n<pre>git branch -D temp-branch<\/pre>\n<p><em>Using the &lt;temporary-branch&gt; from the example in step 1.<\/em><\/li>\n<li>Delete the remote temporary-branch on your origin using the following syntax:\n<pre>git push origin --delete &lt;temporary-branch&gt;<\/pre>\n<p>Example<\/p>\n<pre>git push origin --delete temp-branch<\/pre>\n<p><em>Using the &lt;temporary-branch&gt; from the example in step 1.<\/em><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>If your GitHub forked master branch is ahead from the upstream&#8217;s master branch\u00a0and you wanted to make it even (i.e. also lose some work). The following procedure might help you. Note: If you have your default branch protected perform steps 1, 2, 3, 7, 8 and 9.\u00a0 Otherwise just do steps 4, 5 and 6. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,25],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/211"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=211"}],"version-history":[{"count":12,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":225,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions\/225"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}