diff options
Diffstat (limited to 'Documentation/gittutorial-2.txt')
-rw-r--r-- | Documentation/gittutorial-2.txt | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/Documentation/gittutorial-2.txt b/Documentation/gittutorial-2.txt index e3d5c1fbf0..660904686c 100644 --- a/Documentation/gittutorial-2.txt +++ b/Documentation/gittutorial-2.txt @@ -12,8 +12,7 @@ git * DESCRIPTION ----------- -You should work through linkgit:gittutorial[7][A tutorial introduction to -git] before reading this tutorial. +You should work through linkgit:gittutorial[7] before reading this tutorial. The goal of this tutorial is to introduce two fundamental pieces of git's architecture--the object database and the index file--and to @@ -55,15 +54,15 @@ following the example above generates a different SHA1 hash than the one shown above because the commit object records the time when it was created and the name of the person performing the commit. -We can ask git about this particular object with the cat-file +We can ask git about this particular object with the `cat-file` command. Don't copy the 40 hex digits from this example but use those from your own version. Note that you can shorten it to only a few characters to save yourself typing all 40 hex digits: ------------------------------------------------ -$ git-cat-file -t 54196cc2 +$ git cat-file -t 54196cc2 commit -$ git-cat-file commit 54196cc2 +$ git cat-file commit 54196cc2 tree 92b8b694ffb1675e5975148e1121810081dbdffe author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 @@ -166,7 +165,7 @@ hello world! and the "parent" object refers to the previous commit: ------------------------------------------------ -$ git-cat-file commit 54196cc2 +$ git cat-file commit 54196cc2 tree 92b8b694ffb1675e5975148e1121810081dbdffe author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 @@ -213,8 +212,8 @@ designate such an argument. The index file -------------- -The primary tool we've been using to create commits is "git commit --a", which creates a commit including every change you've made to +The primary tool we've been using to create commits is `git-commit +-a`, which creates a commit including every change you've made to your working tree. But what if you want to commit changes only to certain files? Or only certain changes to certain files? @@ -246,7 +245,7 @@ The last diff is empty, but no new commits have been made, and the head still doesn't contain the new line: ------------------------------------------------ -$ git-diff HEAD +$ git diff HEAD diff --git a/file.txt b/file.txt index a042389..513feba 100644 --- a/file.txt @@ -256,7 +255,7 @@ index a042389..513feba 100644 +hello world, again ------------------------------------------------ -So "git diff" is comparing against something other than the head. +So 'git-diff' is comparing against something other than the head. The thing that it's comparing against is actually the index file, which is stored in .git/index in a binary format, but whose contents we can examine with ls-files: @@ -271,9 +270,9 @@ hello world! hello world, again ------------------------------------------------ -So what our "git add" did was store a new blob and then put +So what our 'git-add' did was store a new blob and then put a reference to it in the index file. If we modify the file again, -we'll see that the new modifications are reflected in the "git-diff" +we'll see that the new modifications are reflected in the 'git-diff' output: ------------------------------------------------ @@ -288,7 +287,7 @@ index 513feba..ba3da7b 100644 +again? ------------------------------------------------ -With the right arguments, git diff can also show us the difference +With the right arguments, 'git-diff' can also show us the difference between the working directory and the last commit, or between the index and the last commit: @@ -312,8 +311,8 @@ index a042389..513feba 100644 +hello world, again ------------------------------------------------ -At any time, we can create a new commit using "git commit" (without -the -a option), and verify that the state committed only includes the +At any time, we can create a new commit using 'git-commit' (without +the "-a" option), and verify that the state committed only includes the changes stored in the index file, not the additional change that is still only in our working tree: @@ -330,11 +329,11 @@ index 513feba..ba3da7b 100644 +again? ------------------------------------------------ -So by default "git commit" uses the index to create the commit, not -the working tree; the -a option to commit tells it to first update +So by default 'git-commit' uses the index to create the commit, not +the working tree; the "-a" option to commit tells it to first update the index with all changes in the working tree. -Finally, it's worth looking at the effect of "git add" on the index +Finally, it's worth looking at the effect of 'git-add' on the index file: ------------------------------------------------ @@ -342,7 +341,7 @@ $ echo "goodbye, world" >closing.txt $ git add closing.txt ------------------------------------------------ -The effect of the "git add" was to add one entry to the index file: +The effect of the 'git-add' was to add one entry to the index file: ------------------------------------------------ $ git ls-files --stage @@ -383,14 +382,14 @@ it is marked "changed but not updated". At this point, running "git commit" would create a commit that added closing.txt (with its new contents), but that didn't modify file.txt. -Also, note that a bare "git diff" shows the changes to file.txt, but +Also, note that a bare `git diff` shows the changes to file.txt, but not the addition of closing.txt, because the version of closing.txt in the index file is identical to the one in the working directory. In addition to being the staging area for new commits, the index file is also populated from the object database when checking out a branch, and is used to hold the trees involved in a merge operation. -See the linkgit:gitcore-tutorial[7][core tutorial] and the relevant man +See linkgit:gitcore-tutorial[7] and the relevant man pages for details. What next? @@ -399,20 +398,19 @@ What next? At this point you should know everything necessary to read the man pages for any of the git commands; one good place to start would be with the commands mentioned in link:everyday.html[Everyday git]. You -should be able to find any unknown jargon in the -linkgit:gitglossary[7][Glossary]. +should be able to find any unknown jargon in linkgit:gitglossary[7]. The link:user-manual.html[Git User's Manual] provides a more comprehensive introduction to git. -The linkgit:gitcvs-migration[7][CVS migration] document explains how to +linkgit:gitcvs-migration[7] explains how to import a CVS repository into git, and shows how to use git in a CVS-like way. For some interesting examples of git use, see the link:howto-index.html[howtos]. -For git developers, the linkgit:gitcore-tutorial[7][Core tutorial] goes +For git developers, linkgit:gitcore-tutorial[7] goes into detail on the lower-level git mechanisms involved in, for example, creating a new commit. |