Tag: "commit"

The following topics are under this tag:
  1. Como desfazer o último commit (sem ter dado push)?
  2. Como desfazer o último commit no remote branch?

1. Como desfazer o último commit (sem ter dado push)?

git reset HEAD~
[top] [index]

2. Como desfazer o último commit no remote branch?

Não desfaça! Você pode quebrar os repos das outras pessoas. Mas se mesmo assim você é teimoso (ou é um repo que só você usa), então:

git log # Ache o hash do commit que você quer desfazer.
git push remote_branch_name +hash_que_voce_achou_com_log^:local_branch_name
git reset HEAD^ --hard
git push remote_branch_name -f
[top] [index]