Pull latest changes while doing a rebase.
git pull --rebase origin master
Merge from a branch back to master
git merge --no-ff --no-commit <branch-name>
–no-ff : preserve the branch structure and not just place branch commits on top of master branch.
–no-commit: Don’t auto-commit. This allows you to discard some changes first e.g. a pom.xml version number that is relevant to the merge branch, but not to the master branch.
Throw away last commit [should stash first]
git reset --hard HEAD~
Remove all changes including untracked files [should stash first]
WARNING: this will remove all untracked files as well e.g. “.bat/.sh” files that you may use to do special builds or deployments.
git clean -df git checkout -- .