Search...

Sunday, September 25, 2022

Git Undoing Changes Cheat Sheet

$ git revert <commit>
Create new commit that undoes all of the changes made in , then apply it to the current branch.
 
$ git reset <file>
Remove from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes.
 
$ git clean -n
Shows which files would be removed from working directory. Use the -f flag in place of the -n flag to execute the clean.

No comments: