|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | + "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | +<html> |
| 4 | +<head> |
| 5 | + <title>Git Book - Git Directory and Working Directory</title> |
| 6 | + <meta http-equiv="content-language" content="en"> |
| 7 | + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 8 | + <link rel="icon" href="favicon.png" type="image/png"> |
| 9 | + <link rel="stylesheet" href="assets/blueprint/screen.css" type="text/css" media="screen, projection"> |
| 10 | + <link rel="stylesheet" href="assets/blueprint/print.css" type="text/css" media="print"> |
| 11 | + <!--[if IE]><link rel="stylesheet" href="assets/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> |
| 12 | + <link rel="stylesheet" href="assets/stylesheets/mac_classic.css" type="text/css" media="screen, projection"> |
| 13 | + <link rel="stylesheet" href="assets/stylesheets/style.css" type="text/css" media="screen, projection"> |
| 14 | +</head> |
| 15 | + |
| 16 | +<body> |
| 17 | +<div class="container chapter showgrids"> |
| 18 | + |
| 19 | + <div class="span-21 header"> |
| 20 | + <div class="nav"><a href="1_the_git_object_model.html">Prev</a> <a href="1_the_git_index.html">Next</a></div> |
| 21 | + <div class="title"><a href='index.html'>Git Community Book</a></div> |
| 22 | + </div> |
| 23 | + |
| 24 | + <div class="span-21"> |
| 25 | + <br/> |
| 26 | + </div> |
| 27 | + |
| 28 | + <div class="span-21"> |
| 29 | + <h2>Git Directory and Working Directory</h2> |
| 30 | + |
| 31 | +<h3>The Git Directory</h3> |
| 32 | + |
| 33 | +<p>The 'git directory' is the directory that stores all Git's history and meta |
| 34 | +information for your project - including all of the objects (commits, trees, |
| 35 | +blobs, tags), all of the pointers to where different branches are and more.</p> |
| 36 | + |
| 37 | +<p>There is only one Git Directory per project (as opposed to one per |
| 38 | +subdirectory like with SVN or CVS), and that directory is (by default, though |
| 39 | +not necessarily) '.git' in the root of your project. If you look at the |
| 40 | +contents of that directory, you can see all of your important files:</p> |
| 41 | + |
| 42 | +<pre><code>$>tree -L 1 |
| 43 | +. |
| 44 | +|-- HEAD # pointer to your current branch |
| 45 | +|-- config # your configuration preferences |
| 46 | +|-- description # description of your project |
| 47 | +|-- hooks/ # pre/post action hooks |
| 48 | +|-- index # index file (see next section) |
| 49 | +|-- logs/ # a history of where your branches have been |
| 50 | +|-- objects/ # your objects (commits, trees, blobs, tags) |
| 51 | +`-- refs/ # pointers to your branches |
| 52 | +</code></pre> |
| 53 | + |
| 54 | +<p>(there may be some other files/directories in there as well, but they are not important for now)</p> |
| 55 | + |
| 56 | +<h3>The Working Directory</h3> |
| 57 | + |
| 58 | +<p>The Git 'working directory' is the directory that holds the current checkout |
| 59 | +of the files you are working on. Files in this directory are often removed |
| 60 | +or replaced by Git as you switch branches - this is normal. All your history |
| 61 | +is stored in the Git Directory; the working directory is simply a temporary |
| 62 | +checkout place where you can modify the files until your next commit.</p> |
| 63 | + |
| 64 | + |
| 65 | + </div> |
| 66 | + |
| 67 | + <div class="span-21"> |
| 68 | + <hr/> |
| 69 | + <div class="center"><a href="1_the_git_object_model.html">Prev</a> <a href="1_the_git_index.html">Next</a></div> |
| 70 | + <hr/> |
| 71 | + </div> |
| 72 | + |
| 73 | + <div class="span-17 footer"> |
| 74 | + <div class="menu"> |
| 75 | + This book is maintained by Scott Chacon, and hosting is donated by GitHub. |
| 76 | + <br> |
| 77 | + Please email me at <a href="mailto:schacon@gmail.com">schacon@gmail.com</a> |
| 78 | + with patches, suggestions and comments. |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + <div class="span-4 last center"> |
| 82 | + <a href="http://github.com"><img src="assets/images/github.png" alt="github logo"></a> |
| 83 | + </div> |
| 84 | + |
| 85 | +</div> |
| 86 | + |
| 87 | +<script type="text/javascript"> |
| 88 | +var pageTracker = _gat._getTracker("UA-82337-12"); |
| 89 | +pageTracker._initData(); |
| 90 | +pageTracker._trackPageview(); |
| 91 | +</script> |
| 92 | +<script src="http://static.getclicky.com/40584.js" type="text/javascript"></script> |
| 93 | +<noscript><p><img alt="Clicky" src="http://in.getclicky.com/40584-db6.gif" /></p></noscript> |
| 94 | + |
| 95 | +</body> |
| 96 | +</html> |
0 commit comments