{"id":1093,"date":"2018-05-15T08:39:11","date_gmt":"2018-05-15T08:39:11","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=1093"},"modified":"2024-02-16T10:43:19","modified_gmt":"2024-02-16T10:43:19","slug":"failed-push-cause-modified-remote-git","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=1093","title":{"rendered":"Push rejection (Git)"},"content":{"rendered":"<p><strong>Reason:<\/strong><br \/>\nIf you have updated a local branch and then trying to push it on remote you may got the following error:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nhint: Updates were rejected because the remote contains work that you do\r\nhint: not have locally. This is usually caused by another repository pushing\r\nhint: to the same ref. You may want to first integrate the remote changes\r\nhint: (e.g., &#039;git pull ...&#039;) before pushing again.\r\nhint: See the &#039;Note about fast-forwards&#039; in &#039;git push --help&#039; for details.\r\n<\/pre>\n<p>This happens if someone else has done parallel changes on this branch and pushed it before you did.<\/p>\n<p><strong>Solution:<\/strong><br \/>\nBring your local branch up to date with the remote one, which removes all your local changes on it.<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\ngit fetch origin\r\ngit reset --hard origin\/&lt;branch&gt;\r\n<\/pre>\n<p>Then you have to do your local changes again and afterwards you can try to push it again.<\/p>\n<p>That&#8217;s a reason for the usage of feature branches, cause all you have to do again is rebase and merge.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reason: If you have updated a local branch and then trying to push it on remote you may got the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[24],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/1093"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1093"}],"version-history":[{"count":1,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/1093\/revisions"}],"predecessor-version":[{"id":16820,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/1093\/revisions\/16820"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1093"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}