From 19c3d87cab401864600a905a6fc5d8c61a6cffb2 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sun, 5 Aug 2018 22:21:54 +0100 Subject: [PATCH] Add git config files --- .conduit.yaml | 8 ++++++++ README.md | 29 +++++++++++++++++++++++++++ _git-changes | 7 +++++++ config | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ excludes | 3 +++ 5 files changed, 102 insertions(+) create mode 100644 .conduit.yaml create mode 100644 README.md create mode 100644 _git-changes create mode 100644 config create mode 100644 excludes diff --git a/.conduit.yaml b/.conduit.yaml new file mode 100644 index 0000000..a9daaea --- /dev/null +++ b/.conduit.yaml @@ -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} diff --git a/README.md b/README.md new file mode 100644 index 0000000..f98d754 --- /dev/null +++ b/README.md @@ -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 `. +* `unpublish` delete a remote branch, shorthand for `git push origin :`. +* `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`. diff --git a/_git-changes b/_git-changes new file mode 100644 index 0000000..d703871 --- /dev/null +++ b/_git-changes @@ -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 diff --git a/config b/config new file mode 100644 index 0000000..8628cbb --- /dev/null +++ b/config @@ -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 diff --git a/excludes b/excludes new file mode 100644 index 0000000..4e9f72d --- /dev/null +++ b/excludes @@ -0,0 +1,3 @@ +.local +.enter +.exit