Compare commits

..

1 Commits

Author SHA1 Message Date
300ac43b83 Update _git-changes to complete more branch names 2018-10-23 17:59:45 +01:00
8 changed files with 31 additions and 97 deletions

9
.conduit.yaml Normal file
View File

@@ -0,0 +1,9 @@
---
- location: ~/.config/git
- brew:
- lastpass-cli
- symlink:
- {src: config, dst: ~/.gitconfig}
- {src: _git-changes, dst: ~/.local/share/zsh/site-functions/_git-changes}
- repo:
- git@code.infektor.net:benie/config.git

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
credentials
local

View File

@@ -8,16 +8,15 @@ rather than remembering the plumbing term of a specific command.
* `abandon` abandons all local changes leave a clean repository.
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
* `amend` amends the last commit, shorthand for `git commit --amend`.
* `unamend` applies a negative diff of the last `git commit --amend`.
* `fixup` prepare to fixup a commit, shorthand for `git commit --fixup`.
* `squash` prepare to squash a commit, shorthand for `git commit --squash`.
* `prepare` prepare a branch for merging into another, shorthand for
`git rebase --interactive --fork-point`.
* `list` list local branches, a shorthand for `git branch`.
* `local` list local branches which don't have remote tracking branches.
* `create` creates a new branch, shorthand for `git checkout -b`.
* `delete` deletes an existing branch, shorthand for `git branch -D`.
* `refname` the name of the current branch.
* `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>`.
@@ -26,7 +25,6 @@ rather than remembering the plumbing term of a specific command.
* `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.
* `touched` lists the files which were touched by a selected commit.
* `save` like pushing to the stash but attached to the current branch, shorthand
for `git commit -am "temp!"`.
* `load` like popping from the stash but attached to the current branch, if

View File

@@ -3,6 +3,7 @@
_alternative \
'branches::__git_branch_names' \
'remote-branches::__git_remote_branch_names'
'remote-branches::__git_remote_branch_names_noprefix' \
'remote-branches-prefix::__git_remote_branch_names'
# vim: ft=zsh

66
config
View File

@@ -1,94 +1,62 @@
# vim: ft=gitconfig
[alias]
root = rev-parse --show-toplevel
abandon = !git reset --hard HEAD && git clean -d -f
uncommit = !git reset --soft HEAD~1 && git unstage
unstage = reset -q HEAD --
amend = commit --amend
unamend = !git diff $(git reflog -2 | \
awk \"{print \\$1}\" | \
sed -e ':a' -e 'N' -e '$!ba' -e 's/\\n/../g') | \
git apply - 2> /dev/null || \
echo "\\\\033[31merror:\\\\033[39m last commit was not amended"
fixup = commit --fixup
squash = commit --squash
prepare = rebase -i --fork-point
list = branch
local = !git branch -vv | \
cut -c 3- | \
awk '$3 !~/\\[/ { print $1 }'
recent = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | \
grep 'checkout:' | \
grep -oE '[^ ]+ ~ .*' | \
awk -F~ '!seen[$1]++' | \
head -n 10 | \
awk -F ' ~ HEAD@{' '{printf(\" %s \\033[33m%s\\033[0m\\n\", $1, substr($2, 1, length($2)-1))}'
create = checkout -b
delete = branch -D
refname = rev-parse --abbrev-ref HEAD
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 `git config --get publish.remote || echo origin` `git refname`
unpublish = !git push -u `git config --get publish.remote || echo origin` :`git refname`
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..' --
touched = diff-tree --no-commit-id --name-only -r
tree = log --graph --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)'
tracking = rev-parse --abbrev-ref --symbolic-full-name @{u}
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 -m "temp!"
save = commit -am "temp!"
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
git reset --mixed HEAD~ || echo \"\\033[31merror:\\033[39m commit subject is not: temp!\"'
git reset --mixed HEAD~ || echo \"error: commit subject is not: temp!\"'
[commit]
verbose = true
[core]
editor = vim
excludesfile = ~/.config/git/excludes
[init]
defaultBranch = main
[branch]
sort = -committerdate
[fetch]
prune = true
[help]
autocorrect = -1
[merge]
tool = vimdiff
conflictstyle = diff3
prompt = false
[pager]
status = true
[push]
default = simple
[pull]
rebase = false
[rebase]
autoSquash = true
[user]
useConfigOnly = true
[diff]
tool = vimdiff
algorithm = patience
[difftool]
prompt = false
[merge]
tool = vimdiff2
algorithm = patience
[mergetool]
prompt = false
[include]
path = ~/.config/private/gitconfig
path = ~/.config/work/gitconfig
path = ~/.config/git/local

View File

@@ -1,9 +1,3 @@
.DS_Store
.cache
.config
.local
.enter
.exit
.local
.share
.vim
compile_commands.json

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env zsh
autoload -U colors && colors
git_sync=${GIT_SYNC:-~/.config/git-sync}
if [ ! -f "$git_sync" ]; then
echo "$fg[yellow]warning:${reset_color} sync list does not exist: $git_sync"
exit 0
fi
local repos=($(cat $git_sync))
if [ ${#repos[@]} = 0 ]; then
echo "$fg[yellow]warning:${reset_color} sync list is empty: $git_sync"
exit 0
fi
for repo in $repos; do
print -P "$fg[cyan]synchronizing: $repo${reset_color}"
repo="${repo/#\~/$HOME}"
git -C "$repo" fetch
done

View File

@@ -1,11 +0,0 @@
---
- name: git create symbolic links
file:
state: link
src: '{{item.src}}'
dest: '{{item.dest}}'
with_items:
- src: ~/.config/git/_git-changes
dest: ~/.local/share/zsh/site-functions/_git-changes
- src: ~/.config/git/git-sync
dest: ~/.local/bin/git-sync