Add git config files

This commit is contained in:
Kenneth Benzie 2018-08-05 22:21:54 +01:00
commit 19c3d87cab
5 changed files with 102 additions and 0 deletions

8
.conduit.yaml Normal file
View File

@ -0,0 +1,8 @@
---
- location: ~/.config/git
- symlink:
- {src: config, dst: ~/.gitconfig}
- {src: excludes, dst: ~/.gitexcludes}
- {src: _git-changes, dst: ~/.local/share/zsh/site-functions/_git-changes}
- repo:
- {remote: 'git@code.infektor.net:benie/config.git', name: private}

29
README.md Normal file
View File

@ -0,0 +1,29 @@
# Git Configuration
## Aliases
A set of [Git][git] aliases which follow the idea "say what you mean" rather
than remember the plumbing term of a specific command.
* `abandon` abandons all local changes leave a clean repository.
* `amend` amends the last commit, shorthand for `git commit --amend`.
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
* `squash` perform an interactive rebase to squash all commits since branching,
shorthand for `git rebase -i --fork-point`.
* `list` list local branches, a shorthand for `git branch`.
* `create` creates a new branch, shorthand for `git checkout -b`.
* `delete` deletes an existing branch, shorthand for `git branch -D`.
* `name` the name of the current branch.
* `last` the name of the last branch checked out before the current branch.
* `publish` push and set the tracking branch of a local branch to origin,
shorthand for `git push -u origin <branch>`.
* `unpublish` delete a remote branch, shorthand for `git push origin :<branch>`.
* `force` force push local changes to the remote, shorthand for
* `changes` compare the list of commits on the local branch to another branch,
e.g. when on a feature branch `git changes master` lists the commits which are
not present on the master branch.
`git push --force-with-lease`.
* `save` like pushing to the stash but attached to a branch, shorthand for
`git commit -am temp`.
* `load` like popping from the stash but attached to a branch, shorthand for
`git reset --mixed HEAD`.

7
_git-changes Normal file
View File

@ -0,0 +1,7 @@
#compdef git-changes
#description Compare changes on this branch with another.
_arguments \
'1: :__git_remote_branch_names_noprefix'
# vim: ft=zsh

55
config Normal file
View File

@ -0,0 +1,55 @@
# vim: ft=gitconfig
[alias]
abandon = !git reset --hard HEAD && git clean -d -f
amend = commit --amend
unstage = reset -q HEAD --
squash = rebase -i --fork-point
list = branch
create = checkout -b
delete = branch -D
name = rev-parse --abbrev-ref HEAD
last = !sh -c 'git reflog | grep \" checkout: moving from\" | head -n 1 | awk \"{ print \\$6 }\"'
publish = !git push -u origin `git name`
unpublish = !git push -u origin :`git name`
force = push --force-with-lease
changes = !sh -c 'git log --oneline $1..' --
tree = log --graph --abbrev-commit --oneline --decorate \
--format=format:'%C(yellow)%h%C(reset) %C(blue)%aD%C(reset) %C(green)(%ar)%C(reset)%C(bold)%d%C(reset)%n %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
save = commit -am temp
load = reset --mixed HEAD~
[commit]
verbose = true
[core]
editor = vim
excludesfile = ~/.config/git/excludes
[fetch]
prune = true
[help]
autocorrect = -1
[merge]
tool = vimdiff
conflictstyle = diff3
prompt = false
[pager]
status = true
[push]
default = simple
[user]
useConfigOnly = true
[include]
path = ~/.config/private/gitconfig
path = ~/.config/work/gitconfig

3
excludes Normal file
View File

@ -0,0 +1,3 @@
.local
.enter
.exit