0
I accidentally sent the wrong files in Git, but haven’t put them on the server yet.
How can I undo these Git appointments?
0
I accidentally sent the wrong files in Git, but haven’t put them on the server yet.
How can I undo these Git appointments?
0
$ git commit -m "Enviado por engano" (1)
$ git reset HEAD~ (2)
<< edite os arquivos como for necessário >> (3)
$ git add ... (4)
$ git commit -c ORIG_HEAD (5)
git add
anything you want to include in your new shipmentreset
copied the old header to .git / ORIG_HEAD;
commit
with -c ORIG_HEAD
will open an editor, which initially contains the
log message from the previous confirmation and allows you to edit it.
If you don’t need to edit the message, you can use the -C option.1 Note, however, that you do not need to reset to a previous submission if you just made an error in your confirmation message. The easiest option is git reset
(to move up the changes you’ve made since then) and then, git commit --amend
, which will open your default confirmation message editor pre-filled with the last confirmation message.
Be careful though, if you added new changes to the index, use commit - Amend will add them to your previous commit.
Observation 2: both the question and the answer were drawn from the stackoverflow official, and translated with the aim of contributing to the SOPT community
Browser other questions tagged git
You are not signed in. Login or sign up in order to post.
Use the Git Reset
git reset <id-do-último-commit-correto>
. To capture the id, just usegit log
– Valdeir Psr