Documentation: improve "add", "pull" and "format-patch" examples

Before this patch in "git-add.txt" and "git-format-patch.txt", the
commands used in the examples were "git-CMD" instead of "git CMD".
This patch fixes that.

In "git-pull.txt" only the last example had the code sample in an
asciidoc "Listing Block", and in the other two files, none.
This patch fixes that by putting all code samples in listing
blocks.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder 2008-05-07 06:29:28 +02:00 committed by Junio C Hamano
parent c904bf392d
commit 921177f50f
3 changed files with 100 additions and 61 deletions

View file

@ -98,21 +98,27 @@ those in info/exclude. See link:repository-layout.html[repository layout].
EXAMPLES EXAMPLES
-------- --------
git-add Documentation/\\*.txt::
Adds content from all `\*.txt` files under `Documentation` * Adds content from all `\*.txt` files under `Documentation` directory
directory and its subdirectories. and its subdirectories:
+
------------
$ git add Documentation/\\*.txt
------------
+ +
Note that the asterisk `\*` is quoted from the shell in this Note that the asterisk `\*` is quoted from the shell in this
example; this lets the command to include the files from example; this lets the command to include the files from
subdirectories of `Documentation/` directory. subdirectories of `Documentation/` directory.
git-add git-*.sh:: * Considers adding content from all git-*.sh scripts:
+
Considers adding content from all git-*.sh scripts. ------------
Because this example lets shell expand the asterisk $ git add git-*.sh
(i.e. you are listing the files explicitly), it does not ------------
consider `subdir/git-foo.sh`. +
Because this example lets shell expand the asterisk (i.e. you are
listing the files explicitly), it does not consider
`subdir/git-foo.sh`.
Interactive mode Interactive mode
---------------- ----------------

View file

@ -174,32 +174,47 @@ and file suffix, and number patches when outputting more than one.
EXAMPLES EXAMPLES
-------- --------
git-format-patch -k --stdout R1..R2 | git-am -3 -k:: * Extract commits between revisions R1 and R2, and apply them on top of
Extract commits between revisions R1 and R2, and apply the current branch using `git-am` to cherry-pick them:
them on top of the current branch using `git-am` to +
cherry-pick them. ------------
$ git format-patch -k --stdout R1..R2 | git-am -3 -k
------------
git-format-patch origin:: * Extract all commits which are in the current branch but not in the
Extract all commits which are in the current branch but origin branch:
not in the origin branch. For each commit a separate file +
is created in the current directory. ------------
$ git format-patch origin
------------
+
For each commit a separate file is created in the current directory.
git-format-patch \--root origin:: * Extract all commits that lead to 'origin' since the inception of the
Extract all commits that lead to 'origin' since the project:
inception of the project. +
------------
$ git format-patch \--root origin
------------
git-format-patch -M -B origin:: * The same as the previous one:
The same as the previous one. Additionally, it detects +
and handles renames and complete rewrites intelligently to ------------
produce a renaming patch. A renaming patch reduces the $ git format-patch -M -B origin
amount of text output, and generally makes it easier to ------------
review it. Note that the "patch" program does not +
understand renaming patches, so use it only when you know Additionally, it detects and handles renames and complete rewrites
the recipient uses git to apply your patch. intelligently to produce a renaming patch. A renaming patch reduces
the amount of text output, and generally makes it easier to review it.
Note that the "patch" program does not understand renaming patches, so
use it only when you know the recipient uses git to apply your patch.
git-format-patch -3:: * Extract three topmost commits from the current branch and format them
Extract three topmost commits from the current branch as e-mailable patches:
and format them as e-mailable patches. +
------------
$ git format-patch -3
------------
See Also See Also
-------- --------

View file

@ -111,40 +111,58 @@ rules apply:
EXAMPLES EXAMPLES
-------- --------
git pull, git pull origin:: * Update the remote-tracking branches for the repository
Update the remote-tracking branches for the repository
you cloned from, then merge one of them into your you cloned from, then merge one of them into your
current branch. Normally the branch merged in is current branch:
the HEAD of the remote repository, but the choice is +
determined by the branch.<name>.remote and ------------------------------------------------
branch.<name>.merge options; see linkgit:git-config[1] $ git pull, git pull origin
for details. ------------------------------------------------
+
Normally the branch merged in is the HEAD of the remote repository,
but the choice is determined by the branch.<name>.remote and
branch.<name>.merge options; see linkgit:git-config[1] for details.
git pull origin next:: * Merge into the current branch the remote branch `next`:
Merge into the current branch the remote branch `next`; +
leaves a copy of `next` temporarily in FETCH_HEAD, but ------------------------------------------------
$ git pull origin next
------------------------------------------------
+
This leaves a copy of `next` temporarily in FETCH_HEAD, but
does not update any remote-tracking branches. does not update any remote-tracking branches.
git pull . fixes enhancements:: * Bundle local branch `fixes` and `enhancements` on top of
Bundle local branch `fixes` and `enhancements` on top of the current branch, making an Octopus merge:
the current branch, making an Octopus merge. This `git pull .` +
syntax is equivalent to `git merge`. ------------------------------------------------
$ git pull . fixes enhancements
------------------------------------------------
+
This `git pull .` syntax is equivalent to `git merge`.
git pull -s ours . obsolete:: * Merge local branch `obsolete` into the current branch, using `ours`
Merge local branch `obsolete` into the current branch, merge strategy:
using `ours` merge strategy. +
------------------------------------------------
$ git pull -s ours . obsolete
------------------------------------------------
git pull --no-commit . maint:: * Merge local branch `maint` into the current branch, but do not make
Merge local branch `maint` into the current branch, but a commit automatically:
do not make a commit automatically. This can be used +
when you want to include further changes to the merge, ------------------------------------------------
or want to write your own merge commit message. $ git pull --no-commit . maint
------------------------------------------------
+
This can be used when you want to include further changes to the
merge, or want to write your own merge commit message.
+ +
You should refrain from abusing this option to sneak substantial You should refrain from abusing this option to sneak substantial
changes into a merge commit. Small fixups like bumping changes into a merge commit. Small fixups like bumping
release/version name would be acceptable. release/version name would be acceptable.
Command line pull of multiple branches from one repository:: * Command line pull of multiple branches from one repository:
+ +
------------------------------------------------ ------------------------------------------------
$ git checkout master $ git checkout master
@ -152,12 +170,12 @@ $ git fetch origin +pu:pu maint:tmp
$ git pull . tmp $ git pull . tmp
------------------------------------------------ ------------------------------------------------
+ +
This updates (or creates, as necessary) branches `pu` and `tmp` This updates (or creates, as necessary) branches `pu` and `tmp` in
in the local repository by fetching from the branches the local repository by fetching from the branches (respectively)
(respectively) `pu` and `maint` from the remote repository. `pu` and `maint` from the remote repository.
+ +
The `pu` branch will be updated even if it is does not The `pu` branch will be updated even if it is does not fast-forward;
fast-forward; the others will not be. the others will not be.
+ +
The final command then merges the newly fetched `tmp` into master. The final command then merges the newly fetched `tmp` into master.