Last active
February 24, 2025 12:12
-
-
Save hantoine/8ded929f276938f505244adeb8a4c580 to your computer and use it in GitHub Desktop.
My git config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [user] | |
| email = | |
| name = Antoine Hebert | |
| [alias] | |
| cam = commit -am | |
| s = status | |
| ci = commit | |
| pu = push | |
| llg = log --graph --all --decorate | |
| lg = log --graph --abbrev-commit --decorate --format=format:'%C(cyan)%h%C(reset) - %C(green)(%ar)%C(reset) %C()%s%C(reset) %C(cyan)- %an%C(reset)%C(yellow)%d%C(reset)' --all | |
| co = checkout | |
| br = branch | |
| forcepush = push --force-with-lease | |
| branchname = symbolic-ref --short HEAD | |
| # Push the current branch to the remote "origin", and set it to track the upstream branch | |
| publish = "!git push -u origin $(git branchname)" | |
| # Delete the remote version of the current branch | |
| unpublish = "!git push origin :$(git branchname)" | |
| # Delete any branches that have been merged into master | |
| delete-merged-branches = "!git main && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" | |
| # Unstage any files that have been added to the staging area | |
| unstage = reset HEAD | |
| cb = checkout -b | |
| mainbranchname = !git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4 | |
| main = "!git checkout $(git mainbranchname)" | |
| # Create new branch from latest main | |
| nbm = "!f(){ git main && git pull && git cb $1 ; }; f" | |
| # Rebase on origin | |
| ro = "!git fetch && git rebase origin/$(git branchname)" | |
| # Rebase on main | |
| rebasemain = "!git main && git pull && git co - && git rebase $(git mainbranchname)" | |
| # Merge main to branch | |
| mergemain= "!git main && git pull && git co - && git merge $(git mainbranchname)" | |
| # Commit an empty commit to rerun CI | |
| rerun-checks = "commit -m \"chore: retrigger checks\" --allow-empty" | |
| # Amend commit | |
| update-commit = "commit -a --amend --no-edit" | |
| # Delete current branch and go to main branch | |
| brclean = "!br=$(git branchname) && git main && git br -d $br" | |
| # Find common ancestor with current branch | |
| merge-base-with = "!f(){ git merge-base $(git branchname) $1 ; }; f" | |
| # Rebase current branch on common ancestor with another branch | |
| rebase-on = "!f(){ git rebase --onto $1 $(git merge-base-with $1) $(git branchname); }; f" | |
| # Rebase current branch on main after the PR it was stacked onto go squashed and merged | |
| rebase-on-main = "!f(){ \ | |
| set -eu; \ | |
| git main && git pull && git co - ;\ | |
| common_ancestor=$(git merge-base-with $1); \ | |
| git rebase --onto $(git mainbranchname) $common_ancestor $(git branchname); \ | |
| set +eu; \ | |
| }; f" | |
| [pull] | |
| rebase = false | |
| ff = only | |
| [init] | |
| defaultBranch = main | |
| [rebase] | |
| updateRefs = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment