index 87e60379eb85b92dc10f033cb5230261e0f8a2e7..036a27c41c7d64f44f032de79e29066c1222bbbf 100644 (file)
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 log --graph" with:
+`git log --graph` with:
------------------------------------------------
$ man git-log
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 .
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
------------------------------------------------
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
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
+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
------------------------------------------------
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:
-------------------------------------
/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
-----------------
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:
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.
-------------------------------------
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
-------------------------------------
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
-------------------------------------
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
# 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
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,
-------------------------------------
$ 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