{"id":98,"date":"2009-12-01T11:43:44","date_gmt":"2009-12-01T17:43:44","guid":{"rendered":"http:\/\/www.insomnihack.com\/?p=98"},"modified":"2009-12-16T23:32:26","modified_gmt":"2009-12-17T05:32:26","slug":"git-init","status":"publish","type":"post","link":"https:\/\/www.insomnihack.com\/?p=98","title":{"rendered":"git init"},"content":{"rendered":"<p>After a bit of trial and error, I&#8217;ve managed to get <a href=\"http:\/\/git-scm.com\/\">git<\/a> running on my Windows box under <a href=\"http:\/\/www.cygwin.com\/\">Cygwin<\/a>, on my Macbook Pro using the latest <a href=\"http:\/\/www.macports.org\/\">MacPorts<\/a>, and on a remote repository located on <a href=\"https:\/\/www.nearlyfreespeech.net\/\">NearlyFreeSpeech.net<\/a>. I&#8217;m pretty much a git newb, so what follows may only be interesting to other git newbies.<\/p>\n<p>I was able to get Bash completion working with git by using the instructions I found <a title=\"Git Tab Completion from Cygwin\" href=\"http:\/\/marioaquino.blogspot.com\/2009\/02\/git-tab-completion-from-cygwin.html\">here<\/a>. Bash completion is really nice, especially when typing out branch names.<a href=\"http:\/\/git-scm.com\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"http:\/\/commons.wikimedia.org\/w\/thumb.php?f=Git-logo.svg&amp;width=200px\" alt=\"\" width=\"200\" height=\"73\" \/><\/a><\/p>\n<p>I&#8217;m not currently using any GUIs (although I downloaded <a href=\"http:\/\/gitx.frim.nl\/\">GitX<\/a> on my Mac to look at branches), preferring to immerse myself in the command line in hopes of increasing my understanding of how git works. So far, the experience has been pretty positive. I&#8217;m still just doing basic stuff, and my only branch usage has been to create one-off development branches to hack out a feature. I&#8217;ve been deleting them after I merge back to master.<\/p>\n<p>I have ran into a few issues. Moves aren&#8217;t has carefree was I was led to believe. Simple moves without file modifications are pretty transparent to git, but it doesn&#8217;t like it when you move and significantly edit a file. Instead of a nice rename in git status like this:<\/p>\n<p>[text highlight=&#8221;6&#8243;]<br \/>\n$ git status<br \/>\n# On branch master<br \/>\n# Changes to be committed:<br \/>\n#\u00a0\u00a0 (use &quot;git reset HEAD &lt;file&gt;&#8230;&quot; to unstage)<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 renamed:\u00a0\u00a0\u00a0 bar.py -&gt; foo\/bar.py<br \/>\n#<br \/>\n[\/text]<\/p>\n<p>You get something more frustrating, like this:<\/p>\n<p>[text highlight=&#8221;6,12&#8243;]<br \/>\n$ git status<br \/>\n# On branch master<br \/>\n# Changes to be committed:<br \/>\n#\u00a0\u00a0 (use &quot;git reset HEAD &lt;file&gt;&#8230;&quot; to unstage)<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new file:\u00a0\u00a0 foo\/bar.py<br \/>\n#<br \/>\n# Changed but not updated:<br \/>\n#\u00a0\u00a0 (use &quot;git add\/rm &lt;file&gt;&#8230;&quot; to update what will be committed)<br \/>\n#\u00a0\u00a0 (use &quot;git checkout &#8212; &lt;file&gt;&#8230;&quot; to discard changes in working directory)<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deleted:\u00a0\u00a0\u00a0 bar.py<br \/>\n#<br \/>\n[\/text]<\/p>\n<p>This is a bit of a drag. When refactoring, I don&#8217;t think of where I&#8217;m going to move files first, then edit them. Its all one flow. With subversion, I could always go to the repository and specifically tell svn that a new file and an missing file are the same. With git, I ended up archiving my changes, restoring my working folder, committing the moves, then copying the updated files from my archive. It may take awhile for me to start thinking in terms of move, edit, then commit in order to avoid this kind of problem.<\/p>\n<p>I ran into a odd issue with <a href=\"http:\/\/www.insomnihack.com\/?p=104\">test file permissions getting set to executable<\/a>. I suspect the issue is related to git on Cygwin. Cygwin on an NTFS drive apparently assumes the file mode of new files is +x. I&#8217;ve temporarily worked around the issue by configuring git on Cygwin to ignore file modes.<\/p>\n<p>[text]<br \/>\ngit config core.filemode false<br \/>\n[\/text]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a bit of trial and error, I&#8217;ve managed to get git running on my Windows box under Cygwin, on my Macbook Pro using the latest MacPorts, and on a remote repository located on NearlyFreeSpeech.net. I&#8217;m pretty much a git newb, so what follows may only be interesting to other git newbies. I was able [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[17],"_links":{"self":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts\/98"}],"collection":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98"}],"version-history":[{"count":0,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}