forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 141
doc: convert git-reset, git-rm and git-mv to new documentation format #1896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jnavila
wants to merge
7
commits into
gitgitgadget:master
Choose a base branch
from
jnavila:doc_git_reset
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a6c7de
doc: convert git-reset to new documentation format
jnavila 440eac1
doc: fix synopsis analysis logic
jnavila 6814e98
doc: convert git-rm to new documentation format
jnavila 2a12973
doc: move synopsis git-mv commands in the synopsis section
jnavila 1868dfc
doc: convert git-mv to new documentation format
jnavila 2ddce76
doc: fix asciidoctor synopsis processing of triple-dots
jnavila 2690f84
doc: add markup for characters in Guidelines
jnavila File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,49 +8,48 @@ git-mv - Move or rename a file, a directory, or a symlink | |
|
||
SYNOPSIS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Martin Ågren wrote (reply to this): On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> [verse]
> -'git mv' [<options>] <source>... <destination>
> +'git mv' [-v] [-f] [-n] [-k] <source> <destination>
> +'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory>
Shouldn't "..." be tucked with the preceding "<source>", i.e.,
"<source>..." as it was in the original?
> DESCRIPTION
> -----------
> Move or rename a file, directory, or symlink.
>
> - git mv [-v] [-f] [-n] [-k] <source> <destination>
> - git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>
> -
This is where "<source> ..." comes from. You moved these lines up. Good.
But I do think we want "<source>..."?
Martin |
||
-------- | ||
[verse] | ||
'git mv' [<options>] <source>... <destination> | ||
|
||
[synopsis] | ||
git mv [-v] [-f] [-n] [-k] <source> <destination> | ||
git mv [-v] [-f] [-n] [-k] <source>... <destination-directory> | ||
|
||
DESCRIPTION | ||
----------- | ||
Move or rename a file, directory, or symlink. | ||
|
||
git mv [-v] [-f] [-n] [-k] <source> <destination> | ||
git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> | ||
|
||
In the first form, it renames <source>, which must exist and be either | ||
a file, symlink or directory, to <destination>. | ||
In the second form, the last argument has to be an existing | ||
In the first form, it renames _<source>_, which must exist and be either | ||
a file, symlink or directory, to _<destination>_. | ||
In the second form, _<destination-directory>_ has to be an existing | ||
directory; the given sources will be moved into this directory. | ||
|
||
The index is updated after successful completion, but the change must still be | ||
committed. | ||
|
||
OPTIONS | ||
------- | ||
-f:: | ||
--force:: | ||
`-f`:: | ||
`--force`:: | ||
Force renaming or moving of a file even if the <destination> exists. | ||
-k:: | ||
`-k`:: | ||
Skip move or rename actions which would lead to an error | ||
condition. An error happens when a source is neither existing nor | ||
controlled by Git, or when it would overwrite an existing | ||
file unless `-f` is given. | ||
-n:: | ||
--dry-run:: | ||
`-n`:: | ||
`--dry-run`:: | ||
Do nothing; only show what would happen | ||
|
||
-v:: | ||
--verbose:: | ||
`-v`:: | ||
`--verbose`:: | ||
Report the names of files as they are moved. | ||
|
||
SUBMODULES | ||
---------- | ||
Moving a submodule using a gitfile (which means they were cloned | ||
with a Git version 1.7.8 or newer) will update the gitfile and | ||
core.worktree setting to make the submodule work in the new location. | ||
It also will attempt to update the submodule.<name>.path setting in | ||
the linkgit:gitmodules[5] file and stage that file (unless -n is used). | ||
It also will attempt to update the `submodule.<name>.path` setting in | ||
the linkgit:gitmodules[5] file and stage that file (unless `-n` is used). | ||
|
||
BUGS | ||
---- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,23 @@ git-reset - Reset current HEAD to the specified state | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Martin Ågren wrote (reply to this): Hi Jean-Noël,
On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> - Switch the synopsis to a synopsis block which will automatically
> format placeholders in italics and keywords in monospace
> - Use _<placeholder>_ instead of <placeholder> in the description
> - Use `backticks` for keywords and more complex option
> descriptions. The new rendering engine will apply synopsis rules to
> these spans.
> ---soft::
> +`--soft`::
> Does not touch the index file or the working tree at all (but
> - resets the head to `<commit>`, just like all modes do). This leaves
> - all your changed files "Changes to be committed", as `git status`
> + resets the head to _<commit>_, just like all modes do). This leaves
> + all your changed files "Changes to be committed", as `git status
> would put it.
This loses the closing backtick after "git status".
> ---pathspec-from-file=<file>::
> - Pathspec is passed in `<file>` instead of commandline args. If
> - `<file>` is exactly `-` then standard input is used. Pathspec
> - elements are separated by LF or CR/LF. Pathspec elements can be
> +`--pathspec-from-file=<file>`::
> + Pathspec is passed in _<file>_ instead of commandline args. If
> + _<file>_ is exactly `-` then standard input is used. Pathspec
> + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
> quoted as explained for the configuration variable `core.quotePath`
> (see linkgit:git-config[1]). See also `--pathspec-file-nul` and
> global `--literal-pathspecs`.
>
> ---pathspec-file-nul::
> +`--pathspec-file-nul`::
> Only meaningful with `--pathspec-from-file`. Pathspec elements are
> - separated with NUL character and all other characters are taken
> + separated with _NUL_ character and all other characters are taken
> literally (including newlines and quotes).
I was surprised that you wrapped CR, LF, and NUL in underscores. The
commit message only talks about <placeholders>, similar to
CodingGuidelines. That said, these _CR_ and friends seem to be
consistent with similar conversions you've done before.
Martin |
||
SYNOPSIS | ||
-------- | ||
[verse] | ||
'git reset' [-q] [<tree-ish>] [--] <pathspec>... | ||
'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] | ||
'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...] | ||
'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] | ||
[synopsis] | ||
git reset [-q] [<tree-ish>] [--] <pathspec>... | ||
git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] | ||
git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...] | ||
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] | ||
|
||
DESCRIPTION | ||
----------- | ||
In the first three forms, copy entries from `<tree-ish>` to the index. | ||
In the last form, set the current branch head (`HEAD`) to `<commit>`, | ||
In the first three forms, copy entries from _<tree-ish>_ to the index. | ||
In the last form, set the current branch head (`HEAD`) to _<commit>_, | ||
optionally modifying index and working tree to match. | ||
The `<tree-ish>`/`<commit>` defaults to `HEAD` in all forms. | ||
The _<tree-ish>_/_<commit>_ defaults to `HEAD` in all forms. | ||
|
||
'git reset' [-q] [<tree-ish>] [--] <pathspec>...:: | ||
'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]:: | ||
`git reset [-q] [<tree-ish>] [--] <pathspec>...`:: | ||
`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`:: | ||
These forms reset the index entries for all paths that match the | ||
`<pathspec>` to their state at `<tree-ish>`. (It does not affect | ||
_<pathspec>_ to their state at _<tree-ish>_. (It does not affect | ||
the working tree or the current branch.) | ||
+ | ||
This means that `git reset <pathspec>` is the opposite of `git add | ||
|
@@ -37,64 +37,64 @@ and specifying a commit with `--source`, you | |
can copy the contents of a path out of a commit to the index and to the | ||
working tree in one go. | ||
|
||
'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...]:: | ||
`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`:: | ||
Interactively select hunks in the difference between the index | ||
and `<tree-ish>` (defaults to `HEAD`). The chosen hunks are applied | ||
and _<tree-ish>_ (defaults to `HEAD`). The chosen hunks are applied | ||
in reverse to the index. | ||
+ | ||
This means that `git reset -p` is the opposite of `git add -p`, i.e. | ||
you can use it to selectively reset hunks. See the ``Interactive Mode'' | ||
you can use it to selectively reset hunks. See the "Interactive Mode" | ||
section of linkgit:git-add[1] to learn how to operate the `--patch` mode. | ||
|
||
'git reset' [<mode>] [<commit>]:: | ||
This form resets the current branch head to `<commit>` and | ||
possibly updates the index (resetting it to the tree of `<commit>`) and | ||
the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD` | ||
is set to the tip of the current branch. If `<mode>` is omitted, | ||
defaults to `--mixed`. The `<mode>` must be one of the following: | ||
`git reset [<mode>] [<commit>]`:: | ||
This form resets the current branch head to _<commit>_ and | ||
possibly updates the index (resetting it to the tree of _<commit>_) and | ||
the working tree depending on _<mode>_. Before the operation, `ORIG_HEAD` | ||
is set to the tip of the current branch. If _<mode>_ is omitted, | ||
defaults to `--mixed`. The _<mode>_ must be one of the following: | ||
+ | ||
-- | ||
--soft:: | ||
`--soft`:: | ||
Does not touch the index file or the working tree at all (but | ||
resets the head to `<commit>`, just like all modes do). This leaves | ||
resets the head to _<commit>_, just like all modes do). This leaves | ||
all your changed files "Changes to be committed", as `git status` | ||
would put it. | ||
|
||
--mixed:: | ||
`--mixed`:: | ||
Resets the index but not the working tree (i.e., the changed files | ||
are preserved but not marked for commit) and reports what has not | ||
been updated. This is the default action. | ||
+ | ||
If `-N` is specified, removed paths are marked as intent-to-add (see | ||
linkgit:git-add[1]). | ||
|
||
--hard:: | ||
`--hard`:: | ||
Resets the index and working tree. Any changes to tracked files in the | ||
working tree since `<commit>` are discarded. Any untracked files or | ||
working tree since _<commit>_ are discarded. Any untracked files or | ||
directories in the way of writing any tracked files are simply deleted. | ||
|
||
--merge:: | ||
`--merge`:: | ||
Resets the index and updates the files in the working tree that are | ||
different between `<commit>` and `HEAD`, but keeps those which are | ||
different between _<commit>_ and `HEAD`, but keeps those which are | ||
different between the index and working tree (i.e. which have changes | ||
which have not been added). | ||
If a file that is different between `<commit>` and the index has | ||
If a file that is different between _<commit>_ and the index has | ||
unstaged changes, reset is aborted. | ||
+ | ||
In other words, `--merge` does something like a `git read-tree -u -m <commit>`, | ||
but carries forward unmerged index entries. | ||
|
||
--keep:: | ||
`--keep`:: | ||
Resets index entries and updates files in the working tree that are | ||
different between `<commit>` and `HEAD`. | ||
If a file that is different between `<commit>` and `HEAD` has local | ||
different between _<commit>_ and `HEAD`. | ||
If a file that is different between _<commit>_ and `HEAD` has local | ||
changes, reset is aborted. | ||
|
||
--[no-]recurse-submodules:: | ||
When the working tree is updated, using --recurse-submodules will | ||
`--[no-]recurse-submodules`:: | ||
When the working tree is updated, using `--recurse-submodules` will | ||
also recursively reset the working tree of all active submodules | ||
according to the commit recorded in the superproject, also setting | ||
the submodules' HEAD to be detached at that commit. | ||
the submodules' `HEAD` to be detached at that commit. | ||
-- | ||
|
||
See "Reset, restore and revert" in linkgit:git[1] for the differences | ||
|
@@ -104,31 +104,31 @@ between the three commands. | |
OPTIONS | ||
------- | ||
|
||
-q:: | ||
--quiet:: | ||
`-q`:: | ||
`--quiet`:: | ||
Be quiet, only report errors. | ||
|
||
--refresh:: | ||
--no-refresh:: | ||
`--refresh`:: | ||
`--no-refresh`:: | ||
Refresh the index after a mixed reset. Enabled by default. | ||
|
||
--pathspec-from-file=<file>:: | ||
Pathspec is passed in `<file>` instead of commandline args. If | ||
`<file>` is exactly `-` then standard input is used. Pathspec | ||
elements are separated by LF or CR/LF. Pathspec elements can be | ||
`--pathspec-from-file=<file>`:: | ||
Pathspec is passed in _<file>_ instead of commandline args. If | ||
_<file>_ is exactly `-` then standard input is used. Pathspec | ||
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be | ||
quoted as explained for the configuration variable `core.quotePath` | ||
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and | ||
global `--literal-pathspecs`. | ||
|
||
--pathspec-file-nul:: | ||
`--pathspec-file-nul`:: | ||
Only meaningful with `--pathspec-from-file`. Pathspec elements are | ||
separated with NUL character and all other characters are taken | ||
separated with _NUL_ character and all other characters are taken | ||
literally (including newlines and quotes). | ||
|
||
\--:: | ||
`--`:: | ||
Do not interpret any more arguments as options. | ||
|
||
<pathspec>...:: | ||
`<pathspec>...`:: | ||
Limits the paths affected by the operation. | ||
+ | ||
For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. | ||
|
@@ -348,7 +348,7 @@ $ git commit ... <8> | |
------------ | ||
+ | ||
<1> First, reset the history back one commit so that we remove the original | ||
commit, but leave the working tree with all the changes. The -N ensures | ||
commit, but leave the working tree with all the changes. The `-N` ensures | ||
that any new files added with `HEAD` are still marked so that `git add -p` | ||
will find them. | ||
<2> Next, we interactively select diff hunks to add using the `git add -p` | ||
|
@@ -458,7 +458,7 @@ working index HEAD target working index HEAD | |
--keep B C C | ||
.... | ||
|
||
`reset --merge` is meant to be used when resetting out of a conflicted | ||
`git reset --merge` is meant to be used when resetting out of a conflicted | ||
merge. Any mergy operation guarantees that the working tree file that is | ||
involved in the merge does not have a local change with respect to the index | ||
before it starts, and that it writes the result out to the working tree. So if | ||
|
@@ -467,7 +467,7 @@ between the index and the working tree, then it means that we are not | |
resetting out from a state that a mergy operation left after failing | ||
with a conflict. That is why we disallow `--merge` option in this case. | ||
|
||
`reset --keep` is meant to be used when removing some of the last | ||
`git reset --keep` is meant to be used when removing some of the last | ||
commits in the current branch while keeping changes in the working | ||
tree. If there could be conflicts between the changes in the commit we | ||
want to remove and the changes in the working tree we want to keep, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Martin Ågren wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Jean-Noël Avila wrote (reply to this):