epubjs
Version:
Render ePub documents in the browser, across many devices
37 lines (29 loc) • 3.69 kB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pro Git - professional version control</title>
<meta content="http://www.w3.org/1999/xhtml; charset=utf-8" http-equiv="Content-Type"/>
<link href="stylesheet.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }</style>
</head>
<body class="calibre">
<h2 class="calibre4" id="calibre_pb_71">Plumbing and Porcelain</h2>
<p class="calibre3">This book covers how to use Git with 30 or so verbs such as <code class="calibre10">checkout</code>, <code class="calibre10">branch</code>, <code class="calibre10">remote</code>, and so on. But because Git was initially a toolkit for a VCS rather than a full user-friendly VCS, it has a bunch of verbs that do low-level work and were designed to be chained together UNIX style or called from scripts. These commands are generally referred to as "plumbing" commands, and the more user-friendly commands are called "porcelain" commands.</p>
<p class="calibre3">The book's first eight chapters deal almost exclusively with porcelain commands. But in this chapter, you'll be dealing mostly with the lower-level plumbing commands, because they give you access to the inner workings of Git and help demonstrate how and why Git does what it does. These commands aren't meant to be used manually on the command line, but rather to be used as building blocks for new tools and custom scripts.</p>
<p class="calibre3">When you run <code class="calibre10">git init</code> in a new or existing directory, Git creates the <code class="calibre10">.git</code> directory, which is where almost everything that Git stores and manipulates is located. If you want to back up or clone your repository, copying this single directory elsewhere gives you nearly everything you need. This entire chapter basically deals with the stuff in this directory. Here's what it looks like:</p>
<pre class="calibre9"><code class="calibre10">$ ls
HEAD
branches/
config
description
hooks/
index
info/
objects/
refs/
</code></pre>
<p class="calibre3">You may see some other files in there, but this is a fresh <code class="calibre10">git init</code> repository - it's what you see by default. The <code class="calibre10">branches</code> directory isn't used by newer Git versions, and the <code class="calibre10">description</code> file is only used by the GitWeb program, so don't worry about those. The <code class="calibre10">config</code> file contains your project-specific configuration options, and the <code class="calibre10">info</code> directory keeps a global exclude file for ignored patterns that you don't want to track in a .gitignore file. The <code class="calibre10">hooks</code> directory contains your client- or server-side hook scripts, which are discussed in detail in Chapter 6.</p>
<p class="calibre3">This leaves four important entries: the <code class="calibre10">HEAD</code> and <code class="calibre10">index</code> files and the <code class="calibre10">objects</code> and <code class="calibre10">refs</code> directories. These are the core parts of Git. The <code class="calibre10">objects</code> directory stores all the content for your database, the <code class="calibre10">refs</code> directory stores pointers into commit objects in that data (branches), the <code class="calibre10">HEAD</code> file points to the branch you currently have checked out, and the <code class="calibre10">index</code> file is where Git stores your staging area information. You'll now look at each of these sections in detail to see how Git operates.</p>
</body>
</html>