With my experience using Git so far, which is quite minimal, I have found the following commands to be extremely handy. I’ll keep updating this post from time to time, if I do come across other useful commands. Please note that some of these commands are not recommended as they might re-write history which may not be preferable. Also since I’m relatively new to git, some of these practices may not be advised. I would love to hear feedback regarding this post and about best practices to be followed.
In situations where your local repository is out of sync and you want to get it sync it with the central repository -
To remove the most recent commit -
The “Branch-Edit-Commit-Merge” workflow -
To combine the last n commits into a single commit -
Forcefully push to a repository -
Rebasing -
To check out a remote git branch -
If you want to dicard or keep your uncommited changes to a branch aside, and continue to work on it later -
Syncing a repository with a fork -