Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelocarmona/e2971783726320ff3e412c5d75012a0a to your computer and use it in GitHub Desktop.
Save marcelocarmona/e2971783726320ff3e412c5d75012a0a to your computer and use it in GitHub Desktop.
Cómo deshacer el último commit en git
Existen dos maneras de borrar ese commit:
* Eliminando junto al commit las modificaciones que este contiene
git reset --hard HEAD~1
* Recuperándolas en el área de trabajo para seguir trabajando en ellas
git reset HEAD~1
Create a new branch
git checkout -b [name_of_your_new_branch]
Fusionar commits
git reset --soft HEAD~6
git commit -m 'mensaje de commit'
Previamente a ejecutar el comando commit, se pueden (o no) realizar los ajustes adicionales que se consideren necesarios
Como disclaimer aclaro que no se deben fusionar commits que ya se hayan pusheado
Delete untracked files and directories
git clean -df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment