I accidentally sent the wrong files in Git, but I have not put them on the server yet.
How can I undo these Git appointments?
I accidentally sent the wrong files in Git, but I have not put them on the server yet.
How can I undo these Git appointments?
$ 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 submission reset
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 do not need to edit the message, you can use the -C. 1 Note, however, that you do not need to reset for an earlier submission if you just made a mistake in your confirmation message. The easiest option is git reset
(to upload the changes you've made since then), and then git commit --amend
, which will open your default commit message editor pre-populated with the last commit message. p>
Be careful though, if you added new changes to the index, use commit - amend will add them to your previous commit.