X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgittutorial.txt;h=e71b561172030bbd4c524891f6525fadd160b54b;hb=87fb597d4e3643210e1967d1e3035f28f5b019e5;hp=898acdb5332a8ff98a88780a42c61de1c379bdb0;hpb=6c99f18660f62f90b83f0592c81ab6a4092d6d13;p=git.git diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt index 898acdb53..e71b56117 100644 --- a/Documentation/gittutorial.txt +++ b/Documentation/gittutorial.txt @@ -19,11 +19,11 @@ If you are instead primarily interested in using git to fetch a project, for example, to test the latest version, you may prefer to start with the first two chapters of link:user-manual.html[The Git User's Manual]. -First, note that you can get documentation for a command such as "git -diff" with: +First, note that you can get documentation for a command such as +`git log --graph` with: ------------------------------------------------ -$ man git-diff +$ man git-log ------------------------------------------------ It is a good idea to introduce yourself to git with your name and @@ -58,7 +58,7 @@ You've now initialized the working directory--you may notice a new directory created, named ".git". Next, tell git to take a snapshot of the contents of all files under the -current directory (note the '.'), with linkgit:git-add[1]: +current directory (note the '.'), with 'git-add': ------------------------------------------------ $ git add . @@ -66,7 +66,7 @@ $ git add . This snapshot is now stored in a temporary staging area which git calls the "index". You can permanently store the contents of the index in the -repository with linkgit:git-commit[1]: +repository with 'git-commit': ------------------------------------------------ $ git commit @@ -85,15 +85,15 @@ $ git add file1 file2 file3 ------------------------------------------------ You are now ready to commit. You can see what is about to be committed -using linkgit:git-diff[1] with the --cached option: +using 'git-diff' with the --cached option: ------------------------------------------------ $ git diff --cached ------------------------------------------------ -(Without --cached, linkgit:git-diff[1] will show you any changes that +(Without --cached, 'git-diff' will show you any changes that you've made but not yet added to the index.) You can also get a brief -summary of the situation with linkgit:git-status[1]: +summary of the situation with 'git-status': ------------------------------------------------ $ git status @@ -114,10 +114,10 @@ newly modified content to the index. Finally, commit your changes with: $ git commit ------------------------------------------------ -This will again prompt your for a message describing the change, and then +This will again prompt you for a message describing the change, and then record a new version of the project. -Alternatively, instead of running `git add` beforehand, you can use +Alternatively, instead of running 'git-add' beforehand, you can use ------------------------------------------------ $ git commit -a @@ -136,9 +136,9 @@ commit in the body. Git tracks content not files ---------------------------- -Many revision control systems provide an "add" command that tells the -system to start tracking changes to a new file. Git's "add" command -does something simpler and more powerful: `git add` is used both for new +Many revision control systems provide an `add` command that tells the +system to start tracking changes to a new file. Git's `add` command +does something simpler and more powerful: 'git-add' is used both for new and newly modified files, and in both cases it takes a snapshot of the given files and stages that content in the index, ready for inclusion in the next commit. @@ -316,7 +316,7 @@ $ git remote add bob /home/bob/myrepo ------------------------------------------------ With this, Alice can perform the first operation alone using the -"git fetch" command without merging them with her own branch, +'git-fetch' command without merging them with her own branch, using: ------------------------------------- @@ -324,7 +324,7 @@ $ git fetch bob ------------------------------------- Unlike the longhand form, when Alice fetches from Bob using a -remote repository shorthand set up with `git remote`, what was +remote repository shorthand set up with 'git-remote', what was fetched is stored in a remote tracking branch, in this case `bob/master`. So after this: @@ -368,8 +368,8 @@ $ git config --get remote.origin.url /home/alice/project ------------------------------------- -(The complete configuration created by git-clone is visible using -"git config -l", and the linkgit:git-config[1] man page +(The complete configuration created by 'git-clone' is visible using +`git config -l`, and the linkgit:git-config[1] man page explains the meaning of each option.) Git also keeps a pristine copy of Alice's master branch under the @@ -392,13 +392,13 @@ see linkgit:git-pull[1] for details. Git can also be used in a CVS-like mode, with a central repository that various users push changes to; see linkgit:git-push[1] and -linkgit:gitcvs-migration[7][git for CVS users]. +linkgit:gitcvs-migration[7]. Exploring history ----------------- Git history is represented as a series of interrelated commits. We -have already seen that the git log command can list those commits. +have already seen that the 'git-log' command can list those commits. Note that first line of each git log entry also gives a name for the commit: @@ -411,7 +411,7 @@ Date: Tue May 16 17:18:22 2006 -0700 merge-base: Clarify the comments on post processing. ------------------------------------- -We can give this name to git show to see the details about this +We can give this name to 'git-show' to see the details about this commit. ------------------------------------- @@ -447,7 +447,7 @@ $ git show HEAD^2 # show the second parent of HEAD You can also give commits names of your own; after running ------------------------------------- -$ git-tag v2.5 1b2e1d63ff +$ git tag v2.5 1b2e1d63ff ------------------------------------- you can refer to 1b2e1d63ff by the name "v2.5". If you intend to @@ -469,13 +469,13 @@ $ git reset --hard HEAD^ # reset your current branch and working Be careful with that last command: in addition to losing any changes in the working directory, it will also remove all later commits from this branch. If this branch is the only branch containing those -commits, they will be lost. Also, don't use "git reset" on a +commits, they will be lost. Also, don't use 'git-reset' on a publicly-visible branch that other developers pull from, as it will force needless merges on other developers to clean up the history. -If you need to undo changes that you have pushed, use linkgit:git-revert[1] +If you need to undo changes that you have pushed, use 'git-revert' instead. -The git grep command can search for strings in any version of your +The 'git-grep' command can search for strings in any version of your project, so ------------------------------------- @@ -484,7 +484,7 @@ $ git grep "hello" v2.5 searches for all occurrences of "hello" in v2.5. -If you leave out the commit name, git grep will search any of the +If you leave out the commit name, 'git-grep' will search any of the files it manages in your current directory. So ------------------------------------- @@ -494,7 +494,7 @@ $ git grep "hello" is a quick way to search just the files that are tracked by git. Many git commands also take sets of commits, which can be specified -in a number of ways. Here are some examples with git log: +in a number of ways. Here are some examples with 'git-log': ------------------------------------- $ git log v2.5..v2.6 # commits between v2.5 and v2.6 @@ -504,7 +504,7 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify # Makefile ------------------------------------- -You can also give git log a "range" of commits where the first is not +You can also give 'git-log' a "range" of commits where the first is not necessarily an ancestor of the second; for example, if the tips of the branches "stable-release" and "master" diverged from a common commit some time ago, then @@ -523,13 +523,13 @@ $ git log experimental..stable will show the list of commits made on the stable branch but not the experimental branch. -The "git log" command has a weakness: it must present commits in a +The 'git-log' command has a weakness: it must present commits in a list. When the history has lines of development that diverged and -then merged back together, the order in which "git log" presents +then merged back together, the order in which 'git-log' presents those commits is meaningless. Most projects with multiple contributors (such as the linux kernel, -or git itself) have frequent merges, and gitk does a better job of +or git itself) have frequent merges, and 'gitk' does a better job of visualizing their history. For example, ------------------------------------- @@ -549,7 +549,7 @@ of the file: $ git diff v2.5:Makefile HEAD:Makefile.in ------------------------------------- -You can also use "git show" to see any such file: +You can also use 'git-show' to see any such file: ------------------------------------- $ git show v2.5:Makefile @@ -571,9 +571,9 @@ is based: used to create commits, check out working directories, and hold the various trees involved in a merge. -linkgit:gittutorial-2[7][Part two of this tutorial] explains the object +Part two of this tutorial explains the object database, the index file, and a few other odds and ends that you'll -need to make the most of git. +need to make the most of git. You can find it at linkgit:gittutorial-2[7]. If you don't want to continue with that right away, a few other digressions that may be interesting at this point are: @@ -592,15 +592,17 @@ digressions that may be interesting at this point are: * link:everyday.html[Everyday GIT with 20 Commands Or So] - * linkgit:gitcvs-migration[7][git for CVS users]. + * linkgit:gitcvs-migration[7]: Git for CVS users. SEE ALSO -------- linkgit:gittutorial-2[7], linkgit:gitcvs-migration[7], +linkgit:gitcore-tutorial[7], +linkgit:gitglossary[7], link:everyday.html[Everyday git], link:user-manual.html[The Git User's Manual] GIT --- -Part of the linkgit:git[7] suite. +Part of the linkgit:git[1] suite.