git log --oneline
- Lists all commits in the repository in a compact, one-line format
git commit --allow-empty -m "Empty commit"
- Creates an empty commit with the message “Empty commit”
git commit --allow-empty --allow-empty-message -m ""
- Creates an empty commit with an empty message. Creates an empty commit with an empty message. Useful for triggering CI pipelines and allowing for the creation of GitHub pull request
git reset --soft HEAD~1
- Resets the current branch to the previous commit, keeping the changes in the staging area
git fetch --prune
- Fetches from remote and removes any branches that have been deleted on the remote
git diff main..HEAD
- See diff for changes on your branch but not on main (one way)
git diff main...HEAD
- See diff for change between your brnach and main (two way)
git difftool --staged --tool=code
- Opens the staged changes with the
code
diff tool
- Needs to be setup with:
git config --global difftool.code.cmd 'code --wait --diff --reuse-window "$LOCAL" "$REMOTE"'
(Set code as a diff tool)
git config --global diff.tool code
(Set code as the default diff tool)
git config --global difftool.prompt false
(Disable the per file diff permission)