{"id":170,"date":"2017-07-21T13:28:53","date_gmt":"2017-07-21T12:28:53","guid":{"rendered":"http:\/\/www.cardiomaths.net\/?p=170"},"modified":"2017-07-21T13:28:53","modified_gmt":"2017-07-21T12:28:53","slug":"version-control-with-git","status":"publish","type":"post","link":"http:\/\/www.cardiomaths.net\/index.php\/2017\/07\/21\/version-control-with-git\/","title":{"rendered":"Version control with git"},"content":{"rendered":"<p>This blog is really just a place holder for my notes on using Git, which is probably the most widely used version control system. I swapped over from using CVS a while ago and, while I love Git, it can be a little tricky to get used to.<\/p>\n<p>For my remote repositories I tend to use GitLab, because when I initially develop projects I like to keep them private, and GitLab offers free private accounts.<\/p>\n<p>To start a new project you can either set up a repository on the website of your favourite remote repository (such as GitLab) and use &#8216;git clone&#8217; to copy the repository to your local machine or you can create a repository locally (by moving to the directory where you store your files and using &#8216;git init&#8217;) and then push the repository (&#8216;git push&#8217;) to copy it to the remote repository.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-167\" src=\"http:\/\/www.cardiomaths.net\/wp-content\/uploads\/GitDrawing-1.png\" alt=\"GitDrawing\" width=\"2441\" height=\"1721\" \/><\/p>\n<p>What can be a little confusing is that locally, while there is only one physical copy of your file, there are indexes that track if a file has been &#8216;added&#8217; to a staging area or &#8216;committed&#8217; to your local repository. This means that there is a two-step commit&#8230; you &#8216;git add&#8217; to move a file to the staging area and &#8216;git commit&#8217; to move it to the local repository. A &#8216;git push&#8217; will move any committed files to your remote repository, where they can be accessed by collaborators.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog is really just a place holder for my notes on using Git, which is probably the most widely used version control system. I swapped over from using CVS a while ago and, while I love Git, it can be a little tricky to get used to. For my remote repositories I tend to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/posts\/170"}],"collection":[{"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":1,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":171,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions\/171"}],"wp:attachment":[{"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cardiomaths.net\/index.php\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}