git log -3Current branch
git log --graph --oneline --decorateAll branches
git log --graph --oneline --decorate --all-c: shows the differences from each of the parents to the merge result simultaneously. Furthermore, it lists only files which were modified from all parents.--cc: implies the-coption and further compresses the patch output by omitting uninteresting hunks whose contents in the parents have only two variants and the merge result picks one of them without modification-m: show the full diff like regular commits; for each merge parent, a separate log entry and diff is generated
Reference: Diff Formatting
git log MERGE_COMMIT^..MERGE_COMMIT^2Reference: Git revisions and ranges
git diff -U10Do a force push, but refuse if the remote branch has been updated by somebody else.
git push --force-with-leasegit push --delete origin REF_NAMERemove untracked files from the working tree.
git clean-n: dry run (just show what would be done)-f: actually remove files (by default git would refuse without this option)
-d: also remove directories-x: also remove ignored files-X: remove only ignored files, but keep untracked files
⚠️ All local commits and changes will be lost.
🆗 Any untracked files will not be affected.
git fetch origin BRANCH_NAME
git reset --hard origin/BRANCH_NAMEIf you want to also remove untracked files, run a git clean.
Reference: How do I force “git pull” to overwrite local files?
When you need to parse Git data inside a custom script, you should use Git low-level commands (plumbing) instead of the main ones (porcelain).