Compare commits
39 Commits
74a805017a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c6d4bcff4f | |||
| 61ebacc776 | |||
| ba4cf18cd2 | |||
| 75b88f3a59 | |||
| 8a3b86753a | |||
| 7fb360690d | |||
| d5ae3dbfc8 | |||
| 753778c632 | |||
| 2d898122c3 | |||
| c2e3d6065c | |||
| 0514ccd0c3 | |||
| 2615350bb8 | |||
| e2218750fa | |||
| 2473202cd8 | |||
| 781fff16d6 | |||
| 1f87dfa8a5 | |||
| 561ea3bc1a | |||
| 02a239e1d8 | |||
| 24b44903b5 | |||
| 95c1550d02 | |||
| 4cd036401c | |||
| 347b263fd6 | |||
| 9d77e3e058 | |||
| 75117da7cb | |||
| 46f722b2a7 | |||
| 2e5cf11730 | |||
| 2f16349e97 | |||
| 26ecd94fb4 | |||
| 17a5a0e946 | |||
| 225fe9a243 | |||
| 854df7bc22 | |||
| e63768ba22 | |||
| 9511061155 | |||
| 71ef3dfba5 | |||
| 9c4ee11ed9 | |||
| 1294ea01f2 | |||
| 8e556960fb | |||
| ebc18383ac | |||
| 929cb896b1 |
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
- location: ~/.config/git
|
|
||||||
- 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
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
credentials
|
||||||
|
local
|
||||||
14
README.md
14
README.md
@@ -8,19 +8,16 @@ rather than remembering the plumbing term of a specific command.
|
|||||||
* `abandon` abandons all local changes leave a clean repository.
|
* `abandon` abandons all local changes leave a clean repository.
|
||||||
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
|
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
|
||||||
* `amend` amends the last commit, shorthand for `git commit --amend`.
|
* `amend` amends the last commit, shorthand for `git commit --amend`.
|
||||||
* `fixup` prepare a fixup commit for use with
|
* `unamend` applies a negative diff of the last `git commit --amend`.
|
||||||
`git rebase --interactive --autosquash`, shorthand for `git commit --fixup`.
|
* `fixup` prepare to fixup a commit, shorthand for `git commit --fixup`.
|
||||||
* `squash` prepare a squash commit for use with
|
* `squash` prepare to squash a commit, shorthand for `git commit --squash`.
|
||||||
`git rebase --interactive --autosquash`, shorthand for `git commit --squash`.
|
|
||||||
* `prepare` prepare a branch for merging into another, shorthand for
|
* `prepare` prepare a branch for merging into another, shorthand for
|
||||||
`git rebase --interactive --fork-point`.
|
`git rebase --interactive --fork-point`.
|
||||||
* `list` list local branches, a shorthand for `git branch`.
|
* `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`.
|
* `create` creates a new branch, shorthand for `git checkout -b`.
|
||||||
* `delete` deletes an existing branch, shorthand for `git branch -D`.
|
* `delete` deletes an existing branch, shorthand for `git branch -D`.
|
||||||
* `name` the name of the current branch.
|
* `refname` the name of the current branch.
|
||||||
* `last` the name of the last branch checked out before the current branch.
|
|
||||||
* `checkout-last` checkout the last branch, shorthand for
|
|
||||||
`git checkout $(git last)`.
|
|
||||||
* `publish` push and set the tracking branch of a local branch to origin,
|
* `publish` push and set the tracking branch of a local branch to origin,
|
||||||
shorthand for `git push -u origin <branch>`.
|
shorthand for `git push -u origin <branch>`.
|
||||||
* `unpublish` delete a remote branch, shorthand for `git push origin :<branch>`.
|
* `unpublish` delete a remote branch, shorthand for `git push origin :<branch>`.
|
||||||
@@ -29,6 +26,7 @@ rather than remembering the plumbing term of a specific command.
|
|||||||
* `changes` compare the list of commits on the local branch to another branch,
|
* `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
|
e.g. when on a feature branch `git changes master` lists the commits which are
|
||||||
not present on the master branch.
|
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
|
* `save` like pushing to the stash but attached to the current branch, shorthand
|
||||||
for `git commit -am "temp!"`.
|
for `git commit -am "temp!"`.
|
||||||
* `load` like popping from the stash but attached to the current branch, if
|
* `load` like popping from the stash but attached to the current branch, if
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#compdef git-changes
|
#compdef git-changes
|
||||||
#description Compare changes on this branch with another.
|
#description Compare changes on this branch with another.
|
||||||
|
|
||||||
_arguments '1: :__git_remote_branch_names_noprefix'
|
_alternative \
|
||||||
|
'branches::__git_branch_names' \
|
||||||
|
'remote-branches::__git_remote_branch_names'
|
||||||
|
|
||||||
# vim: ft=zsh
|
# vim: ft=zsh
|
||||||
|
|||||||
67
config
67
config
@@ -1,63 +1,94 @@
|
|||||||
# vim: ft=gitconfig
|
# vim: ft=gitconfig
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
|
root = rev-parse --show-toplevel
|
||||||
|
|
||||||
abandon = !git reset --hard HEAD && git clean -d -f
|
abandon = !git reset --hard HEAD && git clean -d -f
|
||||||
|
uncommit = !git reset --soft HEAD~1 && git unstage
|
||||||
unstage = reset -q HEAD --
|
unstage = reset -q HEAD --
|
||||||
|
|
||||||
amend = commit --amend
|
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
|
fixup = commit --fixup
|
||||||
squash = commit --squash
|
squash = commit --squash
|
||||||
prepare = rebase -i --fork-point
|
prepare = rebase -i --fork-point
|
||||||
|
|
||||||
list = branch
|
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
|
create = checkout -b
|
||||||
delete = branch -D
|
delete = branch -D
|
||||||
name = rev-parse --abbrev-ref HEAD
|
refname = rev-parse --abbrev-ref HEAD
|
||||||
last = !sh -c 'git reflog | grep \" checkout: moving from\" | head -n 1 | awk \"{ print \\$6 }\"'
|
|
||||||
checkout-last = !git checkout `git last`
|
|
||||||
|
|
||||||
publish = !git push -u origin `git name`
|
publish = !git push -u `git config --get publish.remote || echo origin` `git refname`
|
||||||
unpublish = !git push -u origin :`git name`
|
unpublish = !git push -u `git config --get publish.remote || echo origin` :`git refname`
|
||||||
force = push --force-with-lease
|
force = push --force-with-lease
|
||||||
|
|
||||||
changes = !sh -c 'git log --oneline $1..' --
|
changes = !sh -c 'git log --oneline $1..' --
|
||||||
tree = log --graph --abbrev-commit --oneline --decorate \
|
touched = diff-tree --no-commit-id --name-only -r
|
||||||
--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)'
|
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}
|
||||||
|
|
||||||
save = commit -am "temp!"
|
save = commit -m "temp!"
|
||||||
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
|
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
|
||||||
git reset --mixed HEAD~ || echo \"error: commit subject is not: temp!\"'
|
git reset --mixed HEAD~ || echo \"\\033[31merror:\\033[39m commit subject is not: temp!\"'
|
||||||
|
|
||||||
[commit]
|
|
||||||
verbose = true
|
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
editor = vim
|
|
||||||
excludesfile = ~/.config/git/excludes
|
excludesfile = ~/.config/git/excludes
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
|
||||||
|
[branch]
|
||||||
|
sort = -committerdate
|
||||||
|
|
||||||
[fetch]
|
[fetch]
|
||||||
prune = true
|
prune = true
|
||||||
|
|
||||||
[help]
|
[help]
|
||||||
autocorrect = -1
|
autocorrect = -1
|
||||||
|
|
||||||
[merge]
|
|
||||||
tool = vimdiff
|
|
||||||
conflictstyle = diff3
|
|
||||||
prompt = false
|
|
||||||
|
|
||||||
[pager]
|
[pager]
|
||||||
status = true
|
status = true
|
||||||
|
|
||||||
[push]
|
[push]
|
||||||
default = simple
|
default = simple
|
||||||
|
|
||||||
|
[pull]
|
||||||
|
rebase = false
|
||||||
|
|
||||||
[rebase]
|
[rebase]
|
||||||
autoSquash = true
|
autoSquash = true
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
useConfigOnly = true
|
useConfigOnly = true
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
tool = vimdiff
|
||||||
|
algorithm = patience
|
||||||
|
[difftool]
|
||||||
|
prompt = false
|
||||||
|
|
||||||
|
[merge]
|
||||||
|
tool = vimdiff2
|
||||||
|
algorithm = patience
|
||||||
|
[mergetool]
|
||||||
|
prompt = false
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
path = ~/.config/private/gitconfig
|
path = ~/.config/private/gitconfig
|
||||||
path = ~/.config/work/gitconfig
|
path = ~/.config/work/gitconfig
|
||||||
|
path = ~/.config/git/local
|
||||||
|
|||||||
8
excludes
8
excludes
@@ -1,3 +1,9 @@
|
|||||||
.local
|
.DS_Store
|
||||||
|
.cache
|
||||||
|
.config
|
||||||
.enter
|
.enter
|
||||||
.exit
|
.exit
|
||||||
|
.local
|
||||||
|
.share
|
||||||
|
.vim
|
||||||
|
compile_commands.json
|
||||||
|
|||||||
23
git-sync
Executable file
23
git-sync
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/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
|
||||||
11
tasks.yaml
Normal file
11
tasks.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
Reference in New Issue
Block a user