60 lines
1.9 KiB
Nix
60 lines
1.9 KiB
Nix
{ ... }:
|
|
{
|
|
enable = true;
|
|
|
|
extraConfig = {
|
|
pull.rebase = false;
|
|
};
|
|
|
|
aliases = {
|
|
a = "add -p";
|
|
co = "checkout";
|
|
cob = "checkout -b";
|
|
f = "fetch -p";
|
|
c = "commit";
|
|
p = "push";
|
|
ba = "branch -a";
|
|
bd = "branch -d";
|
|
bD = "branch -D";
|
|
d = "diff";
|
|
dc = "diff --cached";
|
|
ds = "diff --staged";
|
|
r = "restore";
|
|
rs = "restore --staged";
|
|
st = "status -sb";
|
|
|
|
# reset
|
|
soft = "reset --soft";
|
|
hard = "reset --hard";
|
|
s1ft = "soft HEAD~1";
|
|
h1rd = "hard HEAD~1";
|
|
|
|
# logging
|
|
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
|
plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
|
|
tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
|
rank = "shortlog -sn --no-merges";
|
|
|
|
# delete merged branches
|
|
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
|
|
|
|
# list files which have changed since REVIEW_BASE
|
|
# (REVIEW_BASE defaults to 'main' in bashrc)
|
|
files = ''!git diff --name-only $(git merge-base HEAD "$REVIEW_BASE")'';
|
|
|
|
# Same as above, but with a diff stat instead of just names
|
|
# (better for interactive use)
|
|
stat = ''!git diff --stat $(git merge-base HEAD "$REVIEW_BASE")'';
|
|
|
|
# Open all files changed since REVIEW_BASE in Vim tabs
|
|
# Then, run fugitive's :Gdiff in each tab, and finally
|
|
# tell vim-gitgutter to show +/- for changes since REVIEW_BASE
|
|
review = ''!vim -p $(git files) +"tabdo Gdiff $REVIEW_BASE" +"let g:gitgutter_diff_base = '$REVIEW_BASE'"'';
|
|
|
|
# Same as the above, except specify names of files as arguments,
|
|
# instead of opening all files:
|
|
# git reviewone foo.js bar.js
|
|
reviewone = ''!vim -p +"tabdo Gdiff $REVIEW_BASE" +"let g:gitgutter_diff_base = '$REVIEW_BASE'"'';
|
|
};
|
|
}
|