{"id":1570,"date":"2018-08-21T11:54:59","date_gmt":"2018-08-21T11:54:59","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=1570"},"modified":"2024-05-08T13:20:59","modified_gmt":"2024-05-08T13:20:59","slug":"handling-featuresfixes-git","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=1570","title":{"rendered":"Handling features\/fixes (Git)"},"content":{"rendered":"<p><strong>1. Create a feature\/fix branch<\/strong><br \/>\nDon&#8217;t work straight on the parent branch if you have to implement a feature\/fix, atleast if more then one person is working on that branch.<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n$ git checkout &lt;parent&gt; &amp;&amp; git pull\r\n$ git checkout -b &lt;feature|fix&gt;\r\n$ git push -u &lt;remote&gt; &lt;feature|fix&gt;\r\n<\/pre>\n<hr>\n<p><strong>2. Add changes on the branch<\/strong><br \/>\nWhile implementing your changes try to seperate them into multiple commits and push them on the remote that other developer can review them.<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n$ git add .\r\n$ git commit -m &quot;&lt;message&gt;&quot;\r\n$ git push\r\n<\/pre>\n<hr>\n<p><strong>3. Bring your changes on the parent<\/strong><br \/>\nIf you want a short linear branch history without merge commits you have to rebase, squash and merge instead of just merging all commits.<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n$ git pull --rebase\r\n$ git checkout &lt;parent&gt;\r\n$ git merge --squash &lt;feature|fix&gt;\r\n$ git commit -m &quot;&lt;message&gt;&quot;\r\n$ git push\r\n<\/pre>\n<hr>\n<p><strong>4. Delete your created branch<\/strong><br \/>\nAs soon as your changes are on the parent branch you should delete your created feature\/fix branch locally and also on the remote repository.<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n$ git branch -d &lt;feature|fix&gt;\r\n$ git push -d &lt;remote&gt; &lt;feature|fix&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. Create a feature\/fix branch Don&#8217;t work straight on the parent branch if you have to implement a feature\/fix, atleast<\/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\/1570"}],"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=1570"}],"version-history":[{"count":2,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/1570\/revisions"}],"predecessor-version":[{"id":17576,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/1570\/revisions\/17576"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1570"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}