The following Git aliases are very helpful for my usual workflow.
[alias]
cm = commit -m
rcm = !git commit --ammend -m
publish = !git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
discard = restore --staged --worktree .
shove = push -f
nudge = push --force-with-lease
sw = switch
cb = switch -c
wip = commit -m wip
fixup = !git reset --soft HEAD~1 && git commit --amend --no-edit
co = checkout
cp = cherry-pick
rb = rebase
rr = pull --rebase origin
ro = remote get-url origin
rnb = branch -m
rfs = git rebase --force -S
dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order
lag = log --graph --all --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order
parent = "!git show-branch | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
opendiff = difftool --no-prompt --tool opendiff --dir-diff
snp = push -set-upstream origin
dp1 = clone --depth 1
lrb = !sh -c '\nten_days_ago=$(date -v-30d +%Y-%m-%d) &&\ngit for-each-ref --sort=committerdate --format \"%(committerdate:short) %(refname:short)\" refs/heads/ |\nawk -v date=\"$ten_days_ago\" \"\\$1 >= date { print }\"\n'
git cb new-branch
git sw other-branch
Commits current changes with "wip" as the commit message. It is helpful to create several commits as checkpoints during development on a feature branch.
git wip
Pulls from origin and rebases current branch. This is helful to stay current on a feature branch during development.
git rr main
Combines latest commit with the previous commit and uses the commit message of the previous commit. This is great for combining a WIP commits before pushing to a remote branch.
git fixup
git publish
git nudge
git shove
List the 10 most recent and shows date. This is useful for changing between the main branch and feature branches.
git lrb