<?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>FND's Blag &#187; Git</title>
	<atom:link href="http://fnd.lewcid.org/blog/archive/tag/git/feed" rel="self" type="application/rss+xml" />
	<link>http://fnd.lewcid.org/blog</link>
	<description>Just Another Personal Wobsite</description>
	<lastBuildDate>Thu, 11 Mar 2010 15:19:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Git Basics: Getting Started</title>
		<link>http://fnd.lewcid.org/blog/archive/58</link>
		<comments>http://fnd.lewcid.org/blog/archive/58#comments</comments>
		<pubDate>Sat, 28 Mar 2009 10:43:00 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[revision control]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=58</guid>
		<description><![CDATA[Since my last post on the subject, I&#8217;ve become much more familiar and comfortable with Git. While I still don&#8217;t consider myself an expert &#8211; especially when it comes to truly distributed collaboration &#8211; I did manage to pass on some basic knowledge to those around me just getting started. In the process I came [...]]]></description>
			<content:encoded><![CDATA[<p>Since my <a href="http://fnd.lewcid.org/blog/archive/21">last post on the subject</a>, I&#8217;ve become much more familiar and comfortable with Git.</p>
<p>While I still don&#8217;t consider myself an expert &#8211; especially when it comes to truly <a href="http://tech.groups.yahoo.com/group/todotxt/message/1891">distributed</a> <a href="http://blog.insoshi.com/2008/10/14/setting-up-your-git-repositories-for-open-source-projects-at-github/">collaboration</a> &#8211; I did manage to pass on some basic knowledge to those around me <a href="http://twitter.com/FND/status/1383015297">just getting started</a>.<br />
<span id="more-58"></span><br />
In the process I came up with a very concise introduction &#8211; and even though it&#8217;s almost trivial, the following illustration of the basic workflow might be worth sharing (ASCII art ahead):</p>
<pre style="line-height: 1.2em">
                                                       repository (remote)
                                                            ^      |
                                                            |      |
                                                           push   pull
                                                            |      |
                                                            |      V
working copy --add--> index (staging area) --commit--> repository (local)
               \                                  /
                \------------commit -a-----------/
</pre>
<p><strong>Useful Commands:</strong></p>
<ul>
<li><code>status</code></li>
<li><code>log [-p] [--stat]</code></li>
<li><code>diff [-w] [--color-words]</code></li>
<li><code>checkout &lt;treeish&gt; &lt;file&gt;</code> (reverting)</li>
<li><code>init</code></li>
<li><code>clone</code></li>
</ul>
<p>My configuration is available <a href="http://github.com/FND/homedir/blob/master/.gitconfig">on GitHub</a> &#8211; this might serve as a reference for further exploration (e.g. aliases).</p>
]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/58/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git-SVN: Using Git to Interact with Subversion Repositories</title>
		<link>http://fnd.lewcid.org/blog/archive/21</link>
		<comments>http://fnd.lewcid.org/blog/archive/21#comments</comments>
		<pubDate>Sat, 24 May 2008 07:00:12 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[revision control]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[TiddlyWiki]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=21</guid>
		<description><![CDATA[Lately I have been reading about and toying with Git a lot &#8212; and I&#8217;m truly fascinated! (In fact, I&#8217;m even using it to track the progress of this very posting.) However, I&#8217;m not primarily interested in the distributed part. More important, to me, is the fact that Git gives me a private revision history [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I have been <a href="http://del.icio.us/Ace_NoOne/versionControl?setcount=100">reading about</a> and toying with <a href="http://en.wikipedia.org/wiki/Git_%28software%29">Git</a> a lot &mdash; and I&#8217;m truly fascinated! (In fact, I&#8217;m even using it to track the progress of this very posting.)<br />
However, I&#8217;m not primarily interested in the <a href="http://en.wikipedia.org/wiki/Distributed_revision_control">distributed</a> part. More important, to me, is the fact that Git gives me a private revision history (local commits). That way I can commit frequently without having to worry about publishing my changes prematurely.<sup>[1]</sup><br />
<span id="more-21"></span><br />
Since for <a href="http://www.tiddlywiki.com">TiddlyWiki</a> we&#8217;re <a href="http://trac.tiddlywiki.org/browser/">using Subversion</a>, I&#8217;ve started looking into Git&#8217;s <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html">SVN module</a>. With this I can use Git locally while still interacting with the public Subversion repository.</p>
<p>The following guide is to serve as a quick introduction to Git-SVN, hopefully making it easy for others (e.g. fellow <a href="http://www.osmosoft.com">Osmosoftonians</a>) to get started.<br />
Note that I&#8217;m an enthusiastic command-line user, which is why this guide does not cover any GUIs. Also, I&#8217;m far from being a Git expert at this point, so feel free to suggest improvements!</p>
<p><strong>Initial Setup</strong></p>
<ul>
<li>
		check out Subversion repository:<sup>[2]</sup><sup>[3]</sup></p>
<pre>git svn clone -T[trunk_subdir] -t[tags_subdir] -b[branches_subdir] [URL]</pre>
<p>		(e.g. <code>git svn clone -TTrunk -tTags -bBranches http://svn.tiddlywiki.org</code>)<br />
		<strong>N.B.:</strong> For TiddlyWiki, it might not be desirable to convert the Trunk, Tags and Branches directories to metadata, as this might interfere with Cook.
	</li>
<li>
		create branch for work in progress (WIP):</p>
<pre>git checkout -b [branch]</pre>
</li>
</ul>
<p><strong>Working with Git</strong></p>
<ul>
<li>
		modify files on WIP branch, creating (and amending) local commits:<sup>[4]</sup></p>
<pre>git add [files]
git commit -m "[message]"
git commit --amend</pre>
</li>
<li>
		switch to master branch:</p>
<pre>git checkout master</pre>
</li>
<li>
		grab changes from WIP branch:<sup>[5]</sup></p>
<pre>git merge --squash [branch]</pre>
</li>
<li>
		commit changes and push to Subversion:<sup>[6]</sup></p>
<pre>git commit -a -m "[message]"
git svn dcommit</pre>
</li>
<li>
		switch back to WIP branch:<sup>[7]</sup></p>
<pre>git checkout [branch]
git reset --hard master</pre>
<p>		(if there are additional commits on the branch, <code>git rebase master</code> should be used &mdash; which might lead to merge conflicts though)
	</li>
</ul>
<p><strong>Useful Commands</strong></p>
<ul>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html">git branch</a> (list, create or delete branches)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-diff.html">git diff [-w] [--color-words]</a> (display changes)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-apply.html">git apply</a> (patching)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-status.html">git status</a> (working tree status)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-log.html">git log</a> (commit history)<sup>[8]</sup>
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html">git reflog</a> (comprehensive history)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn-rebase.html">git svn rebase</a> (update local repository)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html">git checkout [files]</a> (revert changes)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-config.html">git config</a> (user preferences)<sup>[9]</sup>
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/git-gui.html">git gui</a> (graphical user interface)
	</li>
<li>
		<a href="http://www.kernel.org/pub/software/scm/git/docs/gitk.html">gitk</a> (repository browser)
	</li>
</ul>
<p>Thanks to <a href="http://www.kerrybuckley.org">Kerry</a> for getting me started with Git in the first place!</p>
<p><strong>2008-09-30:</strong> minor updates (removed hyphens from <code>git svn</code> commands, updated <code>.gitconfig</code>, note on converting metadata on checkout)</p>
<p><strong>2008-11-03:</strong> changed final <code>git merge master</code> to <code>git reset --hard master</code> (includes a note on <code>git rebase master</code>, as <a href="http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/">recommended by Kerry</a>)</p>
<ol class="footnotes"><li id="footnote_0_21" class="footnote">The same is true for other <a href="http://www.infoq.com/articles/dvcs-guide">DVCS</a>, like <a href="http://en.wikipedia.org/wiki/Mercurial_%28software%29">Mercurial</a> &mdash; though I have only worked with Git so far.</li><li id="footnote_1_21" class="footnote">Cloning an entire Subversion repository can take a while (mostly due to protocol overhead) &mdash; an alternative is to grab only the latest revision:  <code>git svn init [URL]; git svn fetch -r HEAD</code>.</li><li id="footnote_2_21" class="footnote">Instead of manually specifying directory names for trunk, tags and branches, <code>-s</code> can be used for the standard naming convention &#8220;trunk&#8221;, &#8220;tags&#8221; and &#8220;branches&#8221;.</li><li id="footnote_3_21" class="footnote">Use <code>git commit -a -m "[message]"</code> to automatically add all modified files.</li><li id="footnote_4_21" class="footnote">Squashing means that several local commits can be merged into a single commit.</li><li id="footnote_5_21" class="footnote"><code>dcommit</code> will automatically perform an update (<code>rebase</code>).</li><li id="footnote_6_21" class="footnote">The merge operation is required due to the rewritten commit history on the master.</li><li id="footnote_7_21" class="footnote"><code>git log</code> can be used to display the differences between two branches: <code>git log &lt;a&gt;..&lt;b&gt;</code> &mdash; for example: <code>git log origin/master..master</code> (Git repositories), <code>git log remotes/trunk..master</code> (SVN repositories) </li><li id="footnote_8_21" class="footnote">My current <code>.gitconfig</code> file (latest version <a href="http://github.com/FND/homedir/blob/master/.gitconfig">on GitHub</a>):</p>
<pre>[user]
	name = FND
[alias]
	ci = commit
	cia = commit -a
	cim = commit -m
	ciam = commit -a -m
	co = checkout
	diffi = diff -M --color-words
	diffw = diff -M -w
	diffx = diff -M -w --color-words
	merges = merge --squash
[color]
	branch = auto
	diff = auto
	status = auto
[color "branch"]
	current = yellow reverse
	local = yellow
	remote = green
[color "diff"]
	plain = white
	meta = yellow bold
	frag = magenta bold
	old = red bold
	new = green bold
[color "status"]
	header = white
	added = yellow
	changed = green
	untracked = cyan
[svn]
	rmdir = true</pre>
<p></li></ol>]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/21/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
