Add basic shortcuts to configure-git.ps1

This commit is contained in:
Markus Fleschutz 2021-06-21 16:19:10 +02:00
parent 04d88a044e
commit ee03928841

View File

@ -22,8 +22,24 @@ try {
& git config --global core.symlinks true
& git config --global core.longpaths true
& git config --global init.defaultBranch main
if ($lastExitCode -ne "0") { throw "'git config' for settings failed" }
# Basic shortcuts:
& git config --global alias.co "checkout"
& git config --global alias.br "branch"
& git config --global alias.ci "commit"
& git config --global alias.st "status"
& git config --global alias.pl "pull --recurse-submodules"
& git config --global alias.ps "push"
& git config --global alias.mrg "merge --no-commit --no-ff"
& git config --global alias.chp "cherry-pick --no-commit"
& git config --global alias.ls "log -n20 --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(bold blue)by %an%Creset %C(green)%cr%Creset' --abbrev-commit"
& git config --global alias.smu "submodule update --init"
if ($lastExitCode -ne "0") { throw "'git config' for aliases failed" }
write-host -foregroundColor green "✔️ saved your Git configuration, it's now:"
& git config --list
if ($lastExitCode -ne "0") { throw "'git config --list' failed" }
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"