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
- 2.44.1 → 2.45.2 no changes
- 2.44.0 02/23/24
- 2.43.1 → 2.43.5 no changes
- 2.43.0 11/20/23
- 2.39.1 → 2.42.3 no changes
- 2.39.0 12/12/22
- 2.38.1 → 2.38.5 no changes
- 2.38.0 10/02/22
- 2.37.1 → 2.37.7 no changes
- 2.37.0 06/27/22
- 2.30.1 → 2.36.6 no changes
- 2.30.0 12/27/20
- 2.27.1 → 2.29.3 no changes
- 2.27.0 06/01/20
- 2.23.1 → 2.26.3 no changes
- 2.23.0 08/16/19
- 2.22.1 → 2.22.5 no changes
- 2.22.0 06/07/19
- 2.10.5 → 2.21.4 no changes
- 2.9.5 07/30/17
- 2.8.6 no changes
- 2.7.6 07/30/17
- 2.6.7 05/05/17
- 2.1.4 → 2.5.6 no changes
- 2.0.5 12/17/14
RESUMO
git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>… git revert (--continue | --skip | --abort | --quit)
DESCRIÇÃO
Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them. This requires your working tree to be clean (no modifications from the HEAD commit).
Note: git revert is used to record some new commits to reverse the effect of some earlier commits (often only a faulty one). If you want to throw away all uncommitted changes in your working directory, you should see git-reset[1], particularly the --hard
option. If you want to extract specific files as they were in another commit, you should see git-restore[1], specifically the --source
option. Take care with these alternatives as both will discard uncommitted changes in your working directory.
Para as diferenças entre os três comandos consulte "Redefinir, restaurar e reverter" em git[1].
OPÇÕES
- <commit>…
Commits to revert. For a more complete list of ways to spell commit names, see gitrevisions[7]. Sets of commits can also be given but no traversal is done by default, see git-rev-list[1] and its
--no-walk
option.- -e
- --edit
Com esta opção, o comando git revert permitirá a edição da mensagem do commit antes de fazer a reversão do commit. Esta é a predefinição caso execute o comando num terminal.
- -m parent-number
- --mainline parent-number
Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent.
Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring in tree changes introduced by commits that are not ancestors of the previously reverted merge. This may or may not be what you want.
Consulte o Como fazer um revert-a-faulty-merge para mais detalhes.
- --no-edit
Com esta opção, o comando git revert não iniciará o editor das mensagens do commit.
- --cleanup=<modo>
Essa opção define como a mensagem de commit sera limpa antes de ser encaminhada para o maquinário de commit. Para mais detalhes consulte git-commit[1]. Em particular, caso o valor <mode> tenha um valor de tesoura
scissors
, a tesoura será anexada aMERGE_MSG
antes de ser repassada no caso de um conflito.- -n
- --no-commit
Usually the command automatically creates some commits with commit log messages stating which commits were reverted. This flag applies the changes necessary to revert the named commits to your working tree and the index, but does not make the commits. In addition, when this option is used, your index does not have to match the HEAD commit. The revert is done against the beginning state of your index.
Isso é útil durante ao reverter o efeito de um ou mais commits no seu índice, numa linha.
- -S[<keyid>]
- --gpg-sign[=<keyid>]
- --no-gpg-sign
Commits assinados com o GPG O argumento
keyid
é opcional e a predefinição retorna para a identidade de quem fez o commit; caso seja utilizado, deve estar anexado a opção e sem espaço. A opção--no-gpg-sign
é útil para revogar a variável de configuraçãocommit.gpgSign
e a anterior--gpg-sign
.- -s
- --signoff
Add a
Signed-off-by
trailer at the end of the commit message. See the signoff option in git-commit[1] for more information.- --strategy=<estratégia>
Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in git-merge[1] for details.
- -X<opção>
- --strategy-option=<opção>
Pass the merge strategy-specific option through to the merge strategy. See git-merge[1] for details.
- --rerere-autoupdate
- --no-rerere-autoupdate
Após o mecanismo rerere reutilizar uma resolução gravada no conflito atual para atualizar os arquivos na árvore de trabalho, permita que ele também atualize o índice com o resultado da resolução. A opção
--no-rerere-autoupdate
é uma boa maneira de verificar novamente o que orerere
fez e também detectar possíveis erros da mesclagem antes de enviar o resultado para o índice com umgit add
separado.
- --reference
Instead of starting the body of the log message with "This reverts <full-object-name-of-the-commit-being-reverted>.", refer to the commit using "--pretty=reference" format (cf. git-log[1]). The
revert.reference
configuration variable can be used to enable this option by default.
SEQUENCER SUBCOMANDOS
- --continue
Continue a operação em andamento utilizando as informações existentes em
.git/sequencer
. Pode ser utilizado para continuar após a resolução dos conflitos em uma falha na seleção ou reversão da escolha seletiva.- --skip
Ignore o commit atual e continue com o restante da sequência.
- --quit
Esqueça a operação atual em andamento. Pode ser utilizado para limpar a condição do sequenciador após uma falha na seleção ou reversão de uma escolha seletiva.
- --abort
Cancele a operação e retorne a condição pré-sequência.
EXEMPLOS
git revert HEAD~3
Reverta as alterações informadas pelo quarto último commit no HEAD e crie um novo commit com as alterações revertidas.
git revert -n master~5..master~2
Reverta as alterações feitas pelos commits do quinto último commit no master (incluso) para o terceiro último commit no master (incluso), porém não crie nenhum commit com as alterações revertidas. A reversão altera apenas a árvore de trabalho e o índice.
DISCUSSÃO
While git creates a basic commit message automatically, it is strongly recommended to explain why the original commit is being reverted. In addition, repeatedly reverting reverts will result in increasingly unwieldy subject lines, for example Reapply "Reapply "<original-subject>"". Please consider rewording these to be shorter and more unique.
CONFIGURAÇÃO
Warning | Missing See original version for this content. |
Warning | Missing See original version for this content. |
GIT
Parte do conjunto git[1]