cd ~/.config
git clone [email protected]:fprochazka/gitconfig.gitInclude 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/.gitconfiggit clone [email protected]:git/git.gitcd git/contrib/diff-highlightmakesudo 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 (masterormain)git get-main-upstream-branch- Get upstream branch name (upstream/mainororigin/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 cleanupgit 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- Runupcommand 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