Some common and useful Git commands.
git log git reflog By SHA:
git diff --name-only af43c41d..HEADgit diff af43c41d..masterBy branch:
git diff --name-only origin/deploy..mastergit diff origin/deploy..masterReview, alter, remove, amend last 3 commits:
git rebase -i HEAD~3i to enter interactive mode.pick, drop, etc.esc button to exit interactive mode.wq to save and close the file (Git will proceed through the stipulated changes) or type q! to close the file abandoning all changes.git push -f to override previous changes - do not use this on master/main only ever within a development branch.Correct the last commit message:
git commit --amend -m "Your new message"git clean -f -dgit reset --hard HEADgit rebase --abortgit clean -f -dgit reset --hard HEADIf a branch contains a dir in the root with the same name as a branch, Git will now complain.
Use the following instead:
git fetch origin deploy (if freshly cloned)git switch -f deploy