<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cat brain.log &#124; less &#187; git</title>
	<atom:link href="http://log.largevoid.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Mon, 06 Feb 2012 06:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting Up a Remote git Repository</title>
		<link>http://log.largevoid.com/2010/09/setting-up-a-remote-git-repository/</link>
		<comments>http://log.largevoid.com/2010/09/setting-up-a-remote-git-repository/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 19:48:34 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=437</guid>
		<description><![CDATA[There&#8217;s no substituting for git help remote. The following is a common situation. It assumes that reponame.git does not exist on the remote machine and that you&#8217;re in a hurry to get things done. // The remote repo mkdir reponame.git cd reponame.git git init --bare cd .. scp -r reponame.git server.com:/path/to/reponame.git rm -r reponame.git  // [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s no substituting for <code>git help remote</code>.  The following is a common situation.  It assumes that reponame.git does not exist on the remote machine and that you&#8217;re in a hurry to get things done.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">//</span> The remote repo
 <span style="color: #c20cb9; font-weight: bold;">mkdir</span> reponame.git
 <span style="color: #7a0874; font-weight: bold;">cd</span> reponame.git
 <span style="color: #c20cb9; font-weight: bold;">git</span> init <span style="color: #660033;">--bare</span>
 <span style="color: #7a0874; font-weight: bold;">cd</span> ..
 <span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #660033;">-r</span> reponame.git server.com:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>reponame.git
 <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> reponame.git</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">//</span> Optional: add existing code
 <span style="color: #7a0874; font-weight: bold;">cd</span> code
 <span style="color: #c20cb9; font-weight: bold;">git</span> init
 <span style="color: #c20cb9; font-weight: bold;">git</span> add <span style="color: #000000; font-weight: bold;">*</span>.c <span style="color: #000000; font-weight: bold;">*</span>.h Makefile
 <span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;initial import&quot;</span>
 <span style="color: #000000; font-weight: bold;">//</span> <span style="color: #000000; font-weight: bold;">if</span> you somehow already have a remote, first issue <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">git</span> remote <span style="color: #c20cb9; font-weight: bold;">rm</span> origin<span style="color: #000000; font-weight: bold;">`</span>
 <span style="color: #c20cb9; font-weight: bold;">git</span> remote add origin <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>server.com<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>reponame.git
 <span style="color: #c20cb9; font-weight: bold;">git</span> push origin master</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">//</span> Clone remote repo to <span style="color: #7a0874; font-weight: bold;">local</span> system
 <span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>server.com<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>reponame.git
 <span style="color: #000000; font-weight: bold;">//</span> ... now get to work<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/09/setting-up-a-remote-git-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git: Recovering a file that you deleted</title>
		<link>http://log.largevoid.com/2010/03/git-recovering-a-file-that-you-deleted/</link>
		<comments>http://log.largevoid.com/2010/03/git-recovering-a-file-that-you-deleted/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:02:36 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[deleted]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[recover]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=304</guid>
		<description><![CDATA[You might be doing some spring cleaning to your source code, or you might move files around that you think are unnecessary. Later on, you realize that one of the files you removed was a dependency. Now what? For this, we use git checkout. If this is you: ...edit files... git add edited-file git commit [...]]]></description>
			<content:encoded><![CDATA[<p>You might be doing some spring cleaning to your source code, or you might move files around that you think are unnecessary.  Later on, you realize that one of the files you removed was a dependency.  Now what?  For this, we use <code>git checkout</code>.</p>
<p>If this is you:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...edit files...
<span style="color: #c20cb9; font-weight: bold;">git</span> add edited-file
<span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;made changed&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> seemingly-useless-file
<span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;removed unreferenced dependency&quot;</span>
... edit <span style="color: #c20cb9; font-weight: bold;">file</span> ... realize you dynamically included that <span style="color: #c20cb9; font-weight: bold;">file</span> elsewhere..</pre></div></div>

<p>Then you can simply follow up with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> checkout 0a323 <span style="color: #000000; font-weight: bold;">//</span> the previous revision <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">hash</span> from <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">git</span> log<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> seemingly-useless-file seemingly-useless-file.1
<span style="color: #c20cb9; font-weight: bold;">git</span> checkout master
<span style="color: #c20cb9; font-weight: bold;">mv</span> seemingly-useless-file.1 seemingly-useless-file
<span style="color: #c20cb9; font-weight: bold;">git</span> add seemingly-useless-file
<span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Restored seemingly-useless-file&quot;</span></pre></div></div>

<p>You may want to <code>git blame</code> yourself while you&#8217;re at it.</p>
<p>If you know of a better way, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/03/git-recovering-a-file-that-you-deleted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Untrack Files with Git</title>
		<link>http://log.largevoid.com/2009/12/untrack-files-with-git/</link>
		<comments>http://log.largevoid.com/2009/12/untrack-files-with-git/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 04:22:21 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[cached]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[untrack]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=258</guid>
		<description><![CDATA[When I found this little gem, I couldn&#8217;t not (double negative for emphasis) store it for reference. git rm --cached filename Don&#8217;t worry, it won&#8217;t remove your local copy. It just stages it for removal from the history of tracked files. Reference: untrack files in git]]></description>
			<content:encoded><![CDATA[<p>When I found this little gem, I couldn&#8217;t not (double negative for emphasis) store it for reference.</p>
<p><code>git rm --cached filename</code></p>
<p>Don&#8217;t worry, it won&#8217;t remove your local copy.  It just stages it for removal from the history of tracked files.</p>
<p>Reference:<br />
  <a href="http://source.kohlerville.com/?p=149">untrack files in git</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2009/12/untrack-files-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git &#8211; Install and Configure</title>
		<link>http://log.largevoid.com/2009/11/git-install-and-configure/</link>
		<comments>http://log.largevoid.com/2009/11/git-install-and-configure/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 23:19:50 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[revision]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=61</guid>
		<description><![CDATA[Git is a code revision system not much unlike subversion and CVS.  One of the best features of git is that it is a distributed revision system, so you can check-in, check-out, commit, revert, etc without ever needing direct access to the central repository.  You can work with your repository as if it were a [...]]]></description>
			<content:encoded><![CDATA[<p>Git is a code revision system not much unlike subversion and CVS.  One of the best features of git is that it is a distributed revision system, so you can check-in, check-out, commit, revert, etc without ever needing direct access to the central repository.  You can work with your repository as if it were a centralized system if need be found.<span id="more-61"></span></p>
<h3>Installation (from source)</h3>
<p>Go to <a href="http://www.kernel.org/pub/software/scm/git/">http://www.kernel.org/pub/software/scm/git/</a> and pick the latest version (1.6.5.2), then from the command line, issue:</p>
<p><code># Make a temporary directory from which we'll work<br />
mkdir ~/gittmp<br />
cd ~/gittmp</code><br />
<code># Get the source, compile and intsall<br />
wget http://www.kernel.org/pub/software/scm/git/git-1.6.5.2.tar.gz<br />
tar xzf git-1.6.5.2.tar.gz<br />
cd ~/gittmp/git-1.6.5.2<br />
./configure<br />
make<br />
sudo make install<br />
cd  ~/gittmp</code><br />
<code># Get and install the man pages<br />
wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.5.2.tar.gz<br />
sudo tar xzf git-manpages-1.6.5.2.tar.gz -C /usr/local/share/man/<br />
cd ~<br />
rm -r ~/gittmp/</code></p>
<h3>Testing</h3>
<p>Now that we&#8217;ve got everything set up, go ahead and check that everything&#8217;s visible to your path.  Note: You may need to log back in for the settings to be read.<br />
<code>$ which git<br />
/usr/local/bin/git<br />
$ git config --help<br />
--- man page retrieved ---</code></p>
<h3>Configuration</h3>
<p>Now we need to set some globals.  These are used to identify you when pushing changes.<br />
<code>$ git config --global user.name "Scott Chacon"<br />
$ git config --global user.email "schacon@gmail.com"</code></p>
<p>In a <strong>distributed environment</strong>, your workflow might go something like: A writes some code and commits. B pulls code, makes updates, commits.  A updates local copy with B&#8217;s committed changes, continues development.  The flow goes: get updates from peer, make changes, commit.  Here&#8217;s an example:<br />
<code>alice: $ cd ~/project<br />
alice: $ git init<br />
alice: $ git add lib src README CHANGELOG<br />
alice: $ git commit -m "Initialization"<br />
bob: $ git clone /home/alice/project myrepo<br />
bob: $ echo 'I made a change' &gt;&gt; CHANGELOG<br />
bob: $ git commit -a -m "Appended changelog info"<br />
alice: $ cd ~/project<br />
alice: $ git pull /home/bob/myrepo master<br />
alice: $ echo "Confirmed, changes were merged" &gt;&gt; CHANGELOG<br />
alice: $ git commit -a -m "Merged bob's changes with some new additions"</code></p>
<p>Another setup might be to have a <strong>public repository</strong> for centralized access.  It&#8217;s not really a central repository, but it&#8217;s the place where you push all your changes to from any machine you work on.  In this way, anyone can go to exactly one place to get changes you&#8217;ve made, and you can work from any machine with git, using your own public repository as a starting point.<br />
<code>$ git clone --bare ~/proj proj.git<br />
$ touch proj.git/git-daemon-export-ok<br />
$ scp -r /proj.git user@host.com:/path/to/proj.git</code><br />
Want to have access to the repo via <strong>http</strong>?  Try this:<br />
<code>$ mv proj.git /var/www/html/repos/proj.git<br />
$ cd /var/www/html/repos/proj.git<br />
$ git --bare update-server-info<br />
$ chmod a+x hooks/post-update</code><br />
Now anyone can access your repository like so: <code>$ git clone http://example.com/repos/proj.git</code></p>
<p>Prefer a <strong>private repository</strong>?  It&#8217;s easier than the public setup.<br />
You: <code>$ git clone --bare /home/user/myrepo/.git /tmp/myrepo.git<br />
$ scp -r /tmp/myrepo.git myserver.com:/opt/git/myrepo.git</code><br />
Peer: <code>$ git clone myserver.com:/opt/git/myrepo.git</code></p>
<p>So how do these shared repositories work?</p>
<ol>
<li> clone to initialize local git revision management</li>
<li> modify/commit/revert/etc locally (1 or more times)</li>
<li> push up to the shared repository</li>
</ol>
<p>Peer: &#8230; makes changes to source &#8230;<br />
Peer: <code>$ git commit -a -m "I made a few changes"</code><br />
Peer: &#8230; continue editing until ready for consumption &#8230;<br />
Peer: <code>$ git commit -a -m "I made a few more changes"</code><br />
Peer: <code>$ git push ssh://yourserver.com/~you/proj.git master[:master]</code><br />
You: <code>$ git clone myserver.com:/opt/git/myrepo.git</code><br />
You: &#8230; editing/conflict management/etc. &#8230;<br />
You: <code>$ git commit -a -m "Pretty up peer's changes (minor edits)"</code><br />
You: <code>$ git push ssh://yourserver.com/~you/proj.git master[:master]</code></p>
<h3>Using Git on Windows</h3>
<p>If you plan on using Git on Windows (Sure, why not? masochists pssht) you could install <a href="http://sourceforge.net/projects/gitextensions/">Git Extensions (Windows)</a> from <a href="http://git-scm.com/tools">http://git-scm.com/tools</a>.  At least, that&#8217;s what I did.  It was confusing as all hell, until I went through all possible alternatives that appeared easier than understanding what a <a href="http://www.kernel.org/pub/software/scm/git/docs/git-remote.html">remote</a> is.  The key to getting it all to work is setting up ssh keys so that you can auto-logon to whatever server has your git repositories with the ssh protocol.  If you&#8217;re using the git protocol, I don&#8217;t think that applies.  I could be wrong on this.</p>
<p>Once you&#8217;ve installed <strong>Git Extensions</strong>, load it up, do some general configuration (user.name, user.email, etc.), then select from the menu bar <em>Remotes</em>-&gt;<em>PuTTy</em>-&gt;<em>Generate or import key</em>.  This assumes that you&#8217;ll be using <strong>PuTTY</strong> for all your ssh needs (if applicable).  Anyway, generate a key and save the public key somewhere handy, save the private key somewhere safe.  Now, using that pubkey, follow the advice for <a href="http://log.largevoid.com/2009-09/setting-up-ssh-keys/">Setting up SSH Keys</a>.  You&#8217;re going to want to add that pub key to your authorized_keys on the git repo server.  After that, make sure the PuTTY authentication agent is running (<em>Remotes</em>-&gt;<em>PuTTy</em>-&gt;<em>Start authentication agent</em>).  A new icon should appear in your system tray.  Right click on the new icon to &#8220;<em>Add Key</em>.&#8221;  This key will be your private key.  The agent handles the hand-shaking.</p>
<p>After doing all this the hard way, maybe you should just use the git protocol, but then again, I haven&#8217;t tried it myself.</p>
<h3>Resources</h3>
<p>Finally, it&#8217;s probably best to read Git&#8217;s HOWTOs and Tutorials.</p>
<ul>
<li><a href="http://git.or.cz/gitwiki/Installation">Git Installation</a></li>
<li><a href="http://book.git-scm.com/book.pdf">Git Community Book</a> (pgs. 40-44, 75-77)</li>
<li><a href="http://kernel.org/pub/software/scm/git/docs/howto/">Git HOWTOs</a></li>
<li><a href="http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html">Git Tutorial (1of2)</a></li>
<li><a href="http://www.kernel.org/pub/software/scm/git/docs/gittutorial-2.html">Git Tutorial (2of2)</a></li>
<li>man git</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2009/11/git-install-and-configure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  log.largevoid.com/tag/git/feed/ ) in 0.49921 seconds, on Feb 8th, 2012 at 3:53 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 4:53 am UTC -->
