diff options
Diffstat (limited to 'git')
-rw-r--r-- | git/config | 77 | ||||
-rw-r--r-- | git/package.toml | 3 |
2 files changed, 80 insertions, 0 deletions
diff --git a/git/config b/git/config new file mode 100644 index 0000000..cc473ed --- /dev/null +++ b/git/config @@ -0,0 +1,77 @@ +[pretty] + log = %C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(auto)%d%C(reset) + oldlog = %C(blue)%h%C(reset) - %C(white)(%ar)%C(reset) %s %C(red)%d%C(reset) %C(bold blue)— %an%C(reset) + +[alias] + lg = log --graph --abbrev-commit --color --pretty=log + + l = lg -n 15 + ll = lg --all + lf = lg --name-status + lp = lg --first-parent + + s = status -s + ss = status + a = add + ai = add -i + p = push + pu = pull + f = fetch + fa = fetch --all + c = commit + dt = difftool + dtg = difftool -g + b = branch + bv = branch -v + bva = branch -va + co = checkout + cb = checkout -b + d = diff --stat + dd = diff + m = merge --no-ff + r = remote + rv = remote -v + rb = rebase + rbi = rebase -i + fap = fetch --all -p -t + stash-all = stash save --include-untracked + + # List every branch, local and remote, in order of most recent to oldest commit, showing the branch's last commit and some last commit meta-data + br = for-each-ref --sort=-committerdate refs/heads/ refs/remotes/origin/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' - + + # ff [<args>] + # if no <args> are given, tries to fast-forward with the upstream branch + ff = !"perl -MGit -E' \ + push @ARGV, Git::command_oneline(qw/rev-parse --abbrev-ref --symbolic-full-name @{u}/) unless @ARGV; \ + Git::command_noisy(qw{merge --ff-only}, @ARGV); \ + '" + # ff = merge --ff-only + + # tomerge [<branch> [<regex>]] tells you which branches matching <regex> have not been merged into <branch> yet + # <branch> defaults to HEAD + # <regex> defaults to . + tomerge = !"perl -MGit -E' \ + my ($br, $rx) = (shift // q{HEAD}, shift // qr{.}); \ + say for grep { \ + /$rx/ && !/\\b(master|maint|next)/; \ + } Git::command(qw{branch -r --no-merged}, $br); \ + '" + + # topics [<regex>] + # show topics (branches) matching the ai/description format or <regex> + topics = !"perl -MGit -MList::Util=uniq -E' \ + my $rx = shift // qr{[a-z]{1,3}/.}; \ + say for uniq map { \ + $_ = (split /\\s/)[2]; \ + s!(remotes|origin)/!!g; \ + /$rx/ && !/HEAD/ ? $_ : () \ + } Git::command(qw/branch --sort=committerdate -r/) \ + '" + + # rmbranch [<repository>] <branchname> deletes local and remote branch + # <repository> defaults to origin + rmbranch = !"perl -MGit -E' \ + my ($re, $br) = (@ARGV > 1? shift : q{origin}, shift // q{}); \ + Git::command_noisy(qw{branch -d}, $br); \ + Git::command_noisy(qw{push -d}, $re, $br); \ + '" diff --git a/git/package.toml b/git/package.toml new file mode 100644 index 0000000..946ea2f --- /dev/null +++ b/git/package.toml @@ -0,0 +1,3 @@ +[[files]] +source = './config' +dest = '~/.config/git/config' |