mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
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:
parent
c904bf392d
commit
921177f50f
|
@ -98,21 +98,27 @@ those in info/exclude. See link:repository-layout.html[repository layout].
|
|||
|
||||
EXAMPLES
|
||||
--------
|
||||
git-add Documentation/\\*.txt::
|
||||
|
||||
Adds content from all `\*.txt` files under `Documentation`
|
||||
directory and its subdirectories.
|
||||
* Adds content from all `\*.txt` files under `Documentation` directory
|
||||
and its subdirectories:
|
||||
+
|
||||
------------
|
||||
$ git add Documentation/\\*.txt
|
||||
------------
|
||||
+
|
||||
Note that the asterisk `\*` is quoted from the shell in this
|
||||
example; this lets the command to include the files from
|
||||
subdirectories of `Documentation/` directory.
|
||||
|
||||
git-add git-*.sh::
|
||||
|
||||
Considers adding content from all git-*.sh scripts.
|
||||
Because this example lets shell expand the asterisk
|
||||
(i.e. you are listing the files explicitly), it does not
|
||||
consider `subdir/git-foo.sh`.
|
||||
* Considers adding content from all git-*.sh scripts:
|
||||
+
|
||||
------------
|
||||
$ git add git-*.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
|
||||
----------------
|
||||
|
|
|
@ -174,32 +174,47 @@ and file suffix, and number patches when outputting more than one.
|
|||
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 the current branch using `git-am` to
|
||||
cherry-pick them.
|
||||
* Extract commits between revisions R1 and R2, and apply 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 origin branch. For each commit a separate file
|
||||
is created in the current directory.
|
||||
* Extract all commits which are in the current branch but not in the
|
||||
origin branch:
|
||||
+
|
||||
------------
|
||||
$ 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 project.
|
||||
* Extract all commits that lead to 'origin' since the inception of the
|
||||
project:
|
||||
+
|
||||
------------
|
||||
$ git format-patch \--root origin
|
||||
------------
|
||||
|
||||
git-format-patch -M -B origin::
|
||||
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
|
||||
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.
|
||||
* The same as the previous one:
|
||||
+
|
||||
------------
|
||||
$ git format-patch -M -B origin
|
||||
------------
|
||||
+
|
||||
Additionally, it detects and handles renames and complete rewrites
|
||||
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 as e-mailable patches.
|
||||
* Extract three topmost commits from the current branch and format them
|
||||
as e-mailable patches:
|
||||
+
|
||||
------------
|
||||
$ git format-patch -3
|
||||
------------
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
|
|
@ -111,40 +111,58 @@ rules apply:
|
|||
EXAMPLES
|
||||
--------
|
||||
|
||||
git pull, git pull origin::
|
||||
Update the remote-tracking branches for the repository
|
||||
you cloned from, then merge one of them into your
|
||||
current branch. 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.
|
||||
* Update the remote-tracking branches for the repository
|
||||
you cloned from, then merge one of them into your
|
||||
current branch:
|
||||
+
|
||||
------------------------------------------------
|
||||
$ git pull, git pull origin
|
||||
------------------------------------------------
|
||||
+
|
||||
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`;
|
||||
leaves a copy of `next` temporarily in FETCH_HEAD, but
|
||||
does not update any remote-tracking branches.
|
||||
* Merge into the current branch the remote branch `next`:
|
||||
+
|
||||
------------------------------------------------
|
||||
$ git pull origin next
|
||||
------------------------------------------------
|
||||
+
|
||||
This leaves a copy of `next` temporarily in FETCH_HEAD, but
|
||||
does not update any remote-tracking branches.
|
||||
|
||||
git pull . fixes enhancements::
|
||||
Bundle local branch `fixes` and `enhancements` on top of
|
||||
the current branch, making an Octopus merge. This `git pull .`
|
||||
syntax is equivalent to `git merge`.
|
||||
* Bundle local branch `fixes` and `enhancements` on top of
|
||||
the current branch, making an Octopus 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 strategy.
|
||||
* Merge local branch `obsolete` into the current branch, 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 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.
|
||||
* Merge local branch `maint` into the current branch, but do not make
|
||||
a commit automatically:
|
||||
+
|
||||
------------------------------------------------
|
||||
$ 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
|
||||
changes into a merge commit. Small fixups like bumping
|
||||
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
|
||||
|
@ -152,12 +170,12 @@ $ git fetch origin +pu:pu maint:tmp
|
|||
$ git pull . tmp
|
||||
------------------------------------------------
|
||||
+
|
||||
This updates (or creates, as necessary) branches `pu` and `tmp`
|
||||
in the local repository by fetching from the branches
|
||||
(respectively) `pu` and `maint` from the remote repository.
|
||||
This updates (or creates, as necessary) branches `pu` and `tmp` in
|
||||
the local repository by fetching from the branches (respectively)
|
||||
`pu` and `maint` from the remote repository.
|
||||
+
|
||||
The `pu` branch will be updated even if it is does not
|
||||
fast-forward; the others will not be.
|
||||
The `pu` branch will be updated even if it is does not fast-forward;
|
||||
the others will not be.
|
||||
+
|
||||
The final command then merges the newly fetched `tmp` into master.
|
||||
|
||||
|
|
Loading…
Reference in a new issue