Skip to content

Instantly share code, notes, and snippets.

@castarco
Last active February 23, 2025 14:21
Show Gist options
  • Save castarco/f4b674224f48a9597679a1627f2d44c2 to your computer and use it in GitHub Desktop.
Save castarco/f4b674224f48a9597679a1627f2d44c2 to your computer and use it in GitHub Desktop.
[init]
defaultBranch = main
[commit]
gpgsign = true
template = ${HOME}/.gitmessage
[push]
gpgSign = if-asked
[log]
showSignature = true
[alias]
fixup = "!f() { \
git commit --fixup ${1:-$(git rev-parse HEAD)} \
&& git rebase --autosquash main; \
}; f"
ignored = "!f() { \
git status --ignored -s | grep '!!' | awk '{ print $2 }'; \
}; f"
uncommit = reset HEAD^
xamend = commit --amend
xblame = blame -w -C -C -C
zpull = "!f() { git pull origin $(git branch --show-current); }; f"
xpush = "!f() { git push origin $(git branch --show-current); }; f"
xfpush = "!f() { \
git push --force-with-lease origin $(git branch --show-current); \
}; f"
xmerge = merge --ff-only
xsync = "!f() { \
git switch main \
&& git fetch --all --prune \
&& git pull origin main \
&& git gc --aggressive \
}; f"
xrebase = "!f() { \
BASE_BRANCH=${1:-main}; \
CURRENT_BRANCH=$(git branch --show-current); \
git stash --include-untracked \
&& git switch "${BASE_BRANCH}" \
&& git pull origin "${BASE_BRANCH}" \
&& git switch "${CURRENT_BRANCH}" \
&& git rebase -i --autosquash "${BASE_BRANCH}" \
&& git stash pop; \
}; f"
[merge]
conflictstyle = zdiff3
[rerere]
enabled = true
[rebase]
updateRefs = true
[diff]
algorithm = histogram
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment