Skip to content

Instantly share code, notes, and snippets.

@adenosinew
Last active December 13, 2019 01:54
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 adenosinew/c53e28bac6e14dc737ea1396edbe2db0 to your computer and use it in GitHub Desktop.
Save adenosinew/c53e28bac6e14dc737ea1396edbe2db0 to your computer and use it in GitHub Desktop.
[Git Commands]
# If you are getting below error
# error: Untracked working tree file '***' would be overwritten by merge.
git reset --hard HEAD
git clean -f -d
git pull
# https://www.git-tower.com/learn/git/faq/undo-last-commit
git reset --soft HEAD~1
# Note the --soft flag: this makes sure that the changes in undone revisions are preserved. After running the command, you'll find the changes as uncommitted local modifications in your working copy.
# If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.
git reset --hard HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment