Work with Git can be easy, but sometimes we need to know more than just pull, add, commit and push.
So, below you are going to find examples how to solve the most common scenarios you could face working with Git.
Combine with the previous commit
git commit --amend
Committed all those changes to the master branch by mistake
git branch New-branch git reset HEAD~ --hard git checkout New-branch
Made a spelling mistake in my branch name
git branch -m New-brunch New-branch
Clean up local commits before pushing
git rebase -i
Reverting pushed commits
git revert HEAD
Edit a commit message
git commit --amend -m “new message”
Remove a file from git without removing it from your file system
git reset filename
Undo local commits
git reset HEAD
Discard local file modifications
git checkout -- something
Rollback to a specific point
git reflog git reset HEAD@{XX} -- git add or checkout
Checking the differences between remote and local repository
git diff origin/master master