See full list on atlassian.com
Go back to your last commit, remove all latest changes. Selectively revert one commit, without modifying history (git revert). Change a commit right after it’s been done (git commit --amend). Rewind in time to a previous commit (git reset --hard). May I ask a n00b question about the approach from the section “If your changes are committed, but not pushed”? It appears that reset deletes the commit(s) and then commit creates a new commit. Would it not be better if the original commit(s) (incl. commit message(s)) could be moved from the wrong to the good branch? Again, I’m a Git n00b.
In case you're using the Tower Git client, you can simply hit CMD+Z to undo the last commit: You can use same, simple CMD+Z keyboard shortcut to undo many other actions, from a failed merge to a deleted branch!Mar 27, 2014 · 1. Git Basics Undoing Changes git init <directory> git clone <repo> git config user.name <name> git add <directory> git commit -m "<message>" git status git log git diff Create empty Git repo in speciﬁed directory. Run with no arguments to initialize the current directory as a git repository. Clone repo located at <repo> onto local machine.