diff options
| author | Owen Jacobson <owen.jacobson@grimoire.ca> | 2015-07-03 22:31:49 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen.jacobson@grimoire.ca> | 2015-07-03 22:35:09 -0400 |
| commit | 76aed6ef732de38d82245b3d674f70bab30221e5 (patch) | |
| tree | d50e9a296d91ef8a49bcb29c3e80096f200a3c26 /.html/git/scratch.html | |
| parent | 92f66d3e3a0996bb1fad9dc83d7e184f92673e5d (diff) | |
Fuck it, serve the files directly.
Diffstat (limited to '.html/git/scratch.html')
| -rw-r--r-- | .html/git/scratch.html | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/.html/git/scratch.html b/.html/git/scratch.html new file mode 100644 index 0000000..ff1bdff --- /dev/null +++ b/.html/git/scratch.html @@ -0,0 +1,134 @@ +<!DOCTYPE html> +<html> +<head> + <title> + The Codex » + Git Is Not Magic + </title> + + <link + rel='stylesheet' + type='text/css' + href='http://fonts.googleapis.com/css?family=Buenard:400,700&subset=latin,latin-ext'> + <link + rel="stylesheet" + type="text/css" + href="../media/css/reset.css"> + <link + rel="stylesheet" + type="text/css" + href="../media/css/grimoire.css"> +</head> +<body> + +<div id="shell"> + + <ol id="breadcrumbs"> + + <li class="crumb-0 not-last"> + + <a href="../">index</a> + + </li> + + <li class="crumb-1 not-last"> + + <a href="./">git</a> + + </li> + + <li class="crumb-2 last"> + + scratch + + </li> + + </ol> + + + + <div id="article"> + <h1 id="git-is-not-magic">Git Is Not Magic</h1> +<p>I'm bored. Let's make a git repository out of whole cloth.</p> +<p>Git repos are stored in .git:</p> +<pre><code>fakegit$ mkdir .git +</code></pre> +<p>They have a “symbolic ref” (which are text files, see <a href="http://jk.gs/git-symbolic-ref.html"><code>man +git-symbolic-ref</code></a>) named <code>HEAD</code>, pointing +to the currently checked-out branch. Let's use <code>master</code>. Branches are refs +under <code>refs/heads</code> (see <a href="http://jk.gs/git-branch.html"><code>man git-branch</code></a>):</p> +<pre><code>fakegit ((unknown))$ echo 'ref: refs/heads/master' > .git/HEAD +</code></pre> +<p>The have an object database and a refs database, both of which are simple +directories (see <a href="http://jk.gs/gitrepository-layout.html"><code>man +gitrepository-layout</code></a> and <a href="http://jk.gs/gitrevisions.html"><code>man +gitrevisions</code></a>). Let's also enable the reflog, +because it's a great safety net if you use history-editing tools in git:</p> +<pre><code>fakegit ((ref: re...))$ mkdir .git/refs .git/objects .git/logs +fakegit (master #)$ +</code></pre> +<p>Now <code>__git_ps1</code>, at least, is convinced that we have a working git repository. +Does it work?</p> +<pre><code>fakegit (master #)$ echo 'Hello, world!' > hello.txt +fakegit (master #)$ git add hello.txt +fakegit (master #)$ git commit -m 'Initial commit' +[master (root-commit) 975307b] Initial commit +1 file changed, 1 insertion(+) +create mode 100644 hello.txt + +fakegit (master)$ git log +commit 975307ba0485bff92e295e3379a952aff013c688 +Author: Owen Jacobson <owen.jacobson@grimoire.ca> +Date: Wed Feb 6 10:07:07 2013 -0500 + + Initial commit +</code></pre> +<p><a href="https://www.youtube.com/watch?v=3VwVpaWUu30">Eeyup</a>.</p> +<hr> +<p>Should you do this? <strong>Of course not.</strong> Anywhere you could run these commands, +you could instead run <code>git init</code> or <code>git clone</code>, which set up a number of +other structures, including <code>.git/config</code> and any unusual permissions options. +The key part here is that a directory's identity as “a git repository” is +entirely a function of its contents, not of having been blessed into being by +<code>git</code> itself.</p> +<p>You can infer a lot from this: for example, you can infer that it's “safe” to +move git repositories around using FS tools, or to back them up with the same +tools, for example. This is not as obvious to everyone as you might hope; people </p> + </div> + + + +<div id="comments"> +<div id="disqus_thread"></div> +<script type="text/javascript"> + /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ + var disqus_shortname = 'grimoire'; // required: replace example with your forum shortname + + /* * * DON'T EDIT BELOW THIS LINE * * */ + (function() { + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); +</script> +<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> +<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> +</div> + + + + <div id="footer"> + <p> + + The Codex — + + Powered by <a href="http://markdoc.org/">Markdoc</a>. + +<a href="https://bitbucket.org/ojacobson/grimoire.ca/src/master/wiki/git/scratch.md">See this page on Bitbucket</a> (<a href="https://bitbucket.org/ojacobson/grimoire.ca/history-node/master/wiki/git/scratch.md">history</a>). + + </p> + </div> + +</div> +</body> +</html>
\ No newline at end of file |
