git: Make aliases agnostic of default branch name
This commit is contained in:
parent
d840d4c227
commit
d46eca0ab0
|
@ -54,7 +54,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh.shellAliases = {
|
programs.zsh.shellAliases =
|
||||||
|
let
|
||||||
|
defaultBranch = "\${\${\$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)##refs/remotes/origin/}:-master}";
|
||||||
|
in
|
||||||
|
{
|
||||||
ga = "git add";
|
ga = "git add";
|
||||||
gap = "git add --patch";
|
gap = "git add --patch";
|
||||||
gc = "git commit";
|
gc = "git commit";
|
||||||
|
@ -63,7 +67,7 @@
|
||||||
gcv = "git commit --verbose";
|
gcv = "git commit --verbose";
|
||||||
gd = "git diff";
|
gd = "git diff";
|
||||||
gdc = "git diff --cached";
|
gdc = "git diff --cached";
|
||||||
gfom = "git fetch origin master";
|
gfom = "git fetch origin ${defaultBranch}";
|
||||||
gl = "git log";
|
gl = "git log";
|
||||||
glp = "git log --patch";
|
glp = "git log --patch";
|
||||||
gls = "git log --stat";
|
gls = "git log --stat";
|
||||||
|
@ -71,14 +75,14 @@
|
||||||
grb = "git rebase";
|
grb = "git rebase";
|
||||||
grbi = "git rebase -i";
|
grbi = "git rebase -i";
|
||||||
grbias = "git rebase -i --autosquash";
|
grbias = "git rebase -i --autosquash";
|
||||||
grbim = "git rebase -i master";
|
grbim = "git rebase -i ${defaultBranch}";
|
||||||
grbm = "git rebase master";
|
grbm = "git rebase ${defaultBranch}";
|
||||||
grbom = "git rebase origin/master";
|
grbom = "git rebase origin/${defaultBranch}";
|
||||||
grs = "git restore";
|
grs = "git restore";
|
||||||
grss = "git restore --staged";
|
grss = "git restore --staged";
|
||||||
gs = "git switch";
|
gs = "git switch";
|
||||||
gsc = "git switch -c";
|
gsc = "git switch -c";
|
||||||
gsm = "git switch master";
|
gsm = "git switch ${defaultBranch}";
|
||||||
gst = "git status";
|
gst = "git status";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue