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