summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryushyin <yushyin@saga>2019-04-28 16:17:47 +0200
committeryushyin <yushyin@saga>2019-04-28 16:17:47 +0200
commitd432cf106f210935c64a46aa5f24007e45852adc (patch)
tree16c8c173ef48440af740f3f43abf71e29a55799e
parenta7bdf6eaaa22b26c68ab8b8f1d49d0dca03d1df4 (diff)
downloaddotfiles-d432cf106f210935c64a46aa5f24007e45852adc.tar.gz
dotfiles-d432cf106f210935c64a46aa5f24007e45852adc.tar.xz
Git: Update aliases
-rw-r--r--git/config37
1 files changed, 35 insertions, 2 deletions
diff --git a/git/config b/git/config
index 09e88fe..339ebe7 100644
--- a/git/config
+++ b/git/config
@@ -22,9 +22,42 @@
cb = checkout -b
d = diff --stat
dd = diff
- m = merge
- ff = merge --ff-only
+ 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/) \
+ '"