Setup and Config
Getting and Creating Projects
Basic Snapshotting
Branching and Merging
Sharing and Updating Projects
Inspection and Comparison
Patching
Debugging
External Systems
Server Admin
Guides
- gitattributes
- Command-line interface conventions
- Everyday Git
- Frequently Asked Questions (FAQ)
- Glossary
- Hooks
- gitignore
- gitmodules
- Revisions
- Submodules
- Tutorial
- Workflows
- All guides...
Administration
Plumbing Commands
-
2.54.0
2026-04-20
-
2.53.0
2026-02-02
-
2.52.0
2025-11-17
- 2.51.1 → 2.51.2 no changes
-
2.51.0
2025-08-18
- 2.50.1 no changes
-
2.50.0
2025-06-16
- 2.39.4 → 2.49.1 no changes
-
2.39.3
2023-04-17
- 2.36.1 → 2.39.2 no changes
-
2.36.0
2022-04-18
- 2.34.1 → 2.35.8 no changes
-
2.34.0
2021-11-15
- 2.27.1 → 2.33.8 no changes
-
2.27.0
2020-06-01
- 2.25.1 → 2.26.3 no changes
-
2.25.0
2020-01-13
- 2.23.1 → 2.24.4 no changes
-
2.23.0
2019-08-16
- 2.22.1 → 2.22.5 no changes
-
2.22.0
2019-06-07
- 2.21.1 → 2.21.4 no changes
-
2.21.0
2019-02-24
- 2.20.1 → 2.20.5 no changes
-
2.20.0
2018-12-09
- 2.15.4 → 2.19.6 no changes
-
2.14.6
2019-12-06
-
2.13.7
2018-05-22
-
2.12.5
2017-09-22
- 2.1.4 → 2.11.4 no changes
-
2.0.5
2014-12-17
RESUMO
gitreset[-q] [<tree-ish>] [--] <pathspec>…gitreset[-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]gitreset(--patch|-p) [<tree-ish>] [--] [<pathspec>…]gitreset[--soft|--mixed[-N] |--hard|--merge|--keep] [-q] [<commit>]
DESCRIÇÃO
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.
-
gitreset[-q] [<tree-ish>] [--] <pathspec>... -
gitreset[-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 the working tree or the current branch.)
Isto significa que
gitreset<pathspec> é o oposto degitadd<pathspec>. Este comando é equivalente agitrestore[--source=<árvore>]--staged<pathspec>....Depois de executar o
gitreset<pathspec> para atualizar a entrada do índice, você pode usar o git-restore[1] para verificar o conteúdo do índice para a árvore de trabalho. Como alternativa, utilizando git-restore[1] e especificando um commit com--source, você pode copiar o conteúdo de um caminho de um commit para o índice e a árvore de trabalho de uma vez só. -
gitreset(--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 in reverse to the index.This means that
gitreset-pis the opposite ofgitadd-p, i.e. you can use it to selectively reset hunks. See the "Interactive Mode" section of git-add[1] to learn how to operate the--patchmode. -
gitreset[<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_HEADis set to the tip of the current branch. If <mode> is omitted, defaults to--mixed. The <mode> must be one of the following:-
--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
gitstatuswould put it. -
--mixed -
Redefine o índice, mas não a árvore de trabalho (ou seja, os arquivos alterados são preservados, mas não marcados para um commit) e relata o que não foi atualizado. Esta é a ação predefinida.
Caso
-Nseja especificado, os caminhos removidos serão marcados como uma intenção de adicionar (consulte git-add[1]). -
--hard -
Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted.
-
--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 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 unstaged changes, reset is aborted.Em outras palavras,
--mergefaz algo como umgitread-tree-u-m<commit>, mas carrega as entradas do índice não mescladas adiante. -
--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> andHEADhas local changes, reset is aborted. -
--recurse-submodules -
--no-recurse-submodules -
When the working tree is updated, using
--recurse-submoduleswill also recursively reset the working tree of all active submodules according to the commit recorded in the superproject, also setting the submodules'HEADto be detached at that commit.
-
Para as diferenças entre os três comandos consulte "Redefinir, restaurar e reverter" em git[1].
OPÇÕES
-
-q -
--quiet -
Fique em silêncio, reporte apenas as mensagens de erro.
-
--refresh -
--no-refresh -
Atualize o índice após uma redefinição mista. Ativado por padrão.
-
--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 variablecore.quotePath(see git-config[1]). See also--pathspec-file-nuland global--literal-pathspecs. -
--pathspec-file-nul -
Only meaningful with
--pathspec-from-file. Pathspec elements are separated with NUL character and all other characters are taken literally (including newlines and quotes).
|
Warning
|
Missing See original version for this content. |