Useful Git Commands for daily workflow

The following list are useful git commands that can be used in daily workflow. These commands are often forgotten as they are not used as frequently as simple actions such as adding/committing etc.

How to reset the last commit and bring everything back into the staging area?

git reset HEAD~

How to delete branches locally and remotely?

git branch -d feature/login
git push origin --delete feature/login

How to revert a single file back to its original state?

git checkout @ -- myfile.txt
Posted in Git