cd ~/.config
git clone [email protected]:fprochazka/gitconfig.git
Include configs using a ~/.gitconfig
[include]
path = /home/fprochazka/.config/gitconfig/config/main.gitconfig
[user]
name = your-name
email = your-email
signingkey = 123456789123456798123456789
[init]
defaultBranch = main
[includeIf "gitdir:/home/fprochazka/devel/my-company/"]
path = /home/fprochazka/devel/my-company/.gitconfig
git clone [email protected]:git/git.git
cd git/contrib/diff-highlight
make
sudo mv diff-highlight /usr/local/bin/diff-highlight
This gitconfig provides many custom git commands and aliases for enhanced productivity:
git start
- Initialize repository with an initial empty commit
git h
- Print history of current branch without pager (useful for terminal output)git get-main-branch
- Auto-detect main branch name (master
ormain
)git get-main-upstream-branch
- Get upstream branch name (upstream/main
ororigin/main
)git get-current-branch
- Get current branch name, even during rebase
git wip
- Stage all changes and commit as "WIP [ci skip]"git unwip
- Undo the last WIP commit (reset HEAD~1)
git cif
- Commit as fixup to the latest non-fixup commitgit cifi
- Interactive fixup commit selectiongit slurp
- Move staged changes to previous commit (amend with unstaging)
git com
- Checkout main branch, pull, and also rungit cleanup
git cleanup
- Fetch all remotes, prune, and drop merged/gone branchesgit branches-merged-list
- List local branches merged into maingit branches-merged-drop
- Delete cleanly merged branchesgit branches-gone-list
- List branches whose remotes are gonegit branches-gone-drop
- Delete branches with gone remotes
git branches-stacked-list
- List branches containing commits from current branchgit fpush-stack
- Force-push all branches updated by rebase --update-refs
git up
- Stash changes, fetch, and pull from upstreamgit pu
- Runup
command then push main branch to upstreamgit permission-reset
- Reset file permissions to match repository
git find <pattern>
- Find files in repository by name patterngit cf <commit>
- Show files changed in a commit
git sync-all-repos [dir]
- Recursively sync all git repositories in directorygit gitlab-clone-all
- Clone all repositories from a GitLab group