{"id":4,"date":"2012-05-28T22:54:54","date_gmt":"2012-05-28T22:54:54","guid":{"rendered":"https:\/\/halsafar.ca\/blog\/?p=4"},"modified":"2012-05-28T23:17:47","modified_gmt":"2012-05-28T23:17:47","slug":"git-work-flow","status":"publish","type":"post","link":"https:\/\/halsafar.ca\/blog\/2012\/05\/28\/git-work-flow\/","title":{"rendered":"GIT Work Flow"},"content":{"rendered":"<p>I get asked a lot about SVN, GIT, Mercurial. \u00a0It is clear to me that SVN has been\u00a0superseded\u00a0by GIT and I think many others agree. \u00a0Go ahead and read a great comparison here (<a title=\"GitSVNComparison\" href=\"https:\/\/git.wiki.kernel.org\/index.php\/GitSvnComparison\">GitSVNComparison<\/a>). \u00a0My favorite addition (other than the dramatic decrease in size of repositories) is the branching mechanism that GIT adds. \u00a0This also becomes the learning curve to long time SVN users. \u00a0SVN users famously create the classic trunk,branch,tag structure for every\u00a0repository\u00a0they use but almost never\u00a0utilized\u00a0anything but trunk.<\/p>\n<p>So the biggest learning curve with jumping into GIT is the intended workflow. \u00a0Lets take a quick look at how one should use GIT when working on a group project. \u00a0This workflow maximizes modularity of your code additions and minimizes the downtime created by conflicts. \u00a0To get you thinking while you are reading. \u00a0Typical branching usage is to have each developer work in their own branch.<\/p>\n<p>First some terminology:<\/p>\n<ul>\n<li>master branch &#8211; \u00a0This is essentially your trunk in SVN. \u00a0This is the main working branch in SVN.<\/li>\n<li>local commit &#8211; In GIT everything you commit is local until you push.<\/li>\n<li>remote push &#8211; Since all your commits are local, they need to be pushed to the remote server.<\/li>\n<li>checkout &#8211; In GIT this refers to checking out a branch, the entire repository is morphed into a branch when you perform a checkout.<\/li>\n<\/ul>\n<div>Now the intended workflow:<\/div>\n<div id=\"LC13\">\n<ol>\n<li>Clone the repository, URL is often provided.<br \/>\ngit clone git@github.com:halsafar\/TerraMater.git<\/li>\n<li>Create a branch for you to work in.<br \/>\ngit checkout -b experimentalBranch<\/li>\n<li>Do some work!<\/li>\n<li>Commit your work.<br \/>\ngit commit -a<\/li>\n<li>Push your branch to the remote server (optional!), required if you want to get your branch from another machine.<br \/>\ngit push origin experimentalBranch<\/li>\n<li>\u00a0You have completed your bug fix lets say, time to merge your changes into the master branch. \u00a0First we have to checkout the master branch.<br \/>\ngit checkout master<\/li>\n<li>Make sure we have an updated master branch.<br \/>\ngit pull<\/li>\n<li>Time to merge your branch into master, this is the conflict resolution step.<br \/>\ngit merge experimentalBranch<\/li>\n<li>If all went well, push the updated master branch to the remote repo<br \/>\ngit push<\/li>\n<\/ol>\n<\/div>\n<div id=\"LC13\">\u00a0Now what if we are working on our experimental branch and some very important bugs are fixed and pushed into master. \u00a0These changes will directly impact your work. \u00a0It might be easier at this point to merge master into your branch so you can get the updates and keep working.<\/div>\n<div>\n<ol>\n<li>Make sure you are on your branch.<br \/>\ngit checkout experimentalBranch<\/li>\n<li>Merge master into your branch<br \/>\ngit merge master<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I get asked a lot about SVN, GIT, Mercurial. \u00a0It is clear to me that SVN has been\u00a0superseded\u00a0by GIT and I think many others agree. \u00a0Go ahead and read a great comparison here (GitSVNComparison). \u00a0My favorite addition (other than the<span class=\"ellipsis\">&hellip;<\/span><\/p>\n<div class=\"read-more\"><a href=\"https:\/\/halsafar.ca\/blog\/2012\/05\/28\/git-work-flow\/\">Read more <span class=\"screen-reader-text\">GIT Work Flow<\/span><span class=\"meta-nav\"> &#8250;<\/span><\/a><\/div>\n<p><!-- end of .read-more --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[13,55,22,56],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-developement","tag-development","tag-git","tag-linkedin","tag-repository"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/posts\/4","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/comments?post=4"}],"version-history":[{"count":18,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":443,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/posts\/4\/revisions\/443"}],"wp:attachment":[{"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/media?parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/categories?post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/halsafar.ca\/blog\/wp-json\/wp\/v2\/tags?post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}