Created
February 18, 2026 11:09
-
-
Save adil1214/42f06ee1bf8ec68d43a0fb505f050b2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Oh My Zsh git aliases — PowerShell port for ChrisTitusTech profile | |
| # CTTcustom.ps1 is invoked with & (child scope), so all functions must be | |
| # declared as global: to survive into the parent session scope. | |
| # --------------------------------------------------------------------------- | |
| # Helpers | |
| # --------------------------------------------------------------------------- | |
| function global:git_current_branch { | |
| git rev-parse --abbrev-ref HEAD 2>$null | |
| } | |
| function global:git_main_branch { | |
| $branches = git branch --list main master 2>$null | |
| if ($branches -match '\bmain\b') { return 'main' } | |
| return 'master' | |
| } | |
| function global:git_develop_branch { | |
| $branches = git branch --list dev develop development 2>$null | |
| if ($branches -match '\bdevelop\b') { return 'develop' } | |
| if ($branches -match '\bdev\b') { return 'dev' } | |
| return 'develop' | |
| } | |
| # --------------------------------------------------------------------------- | |
| # Add | |
| # --------------------------------------------------------------------------- | |
| function global:ga { git add @args } | |
| function global:gaa { git add --all @args } | |
| function global:gapa { git add --patch @args } | |
| function global:gau { git add --update @args } | |
| function global:gav { git add --verbose @args } | |
| # --------------------------------------------------------------------------- | |
| # Branch | |
| # --------------------------------------------------------------------------- | |
| function global:gb { git branch @args } | |
| function global:gba { git branch --all @args } | |
| function global:gbd { git branch --delete @args } | |
| function global:gbD { git branch --delete --force @args } | |
| function global:gbr { git branch --remote @args } | |
| # --------------------------------------------------------------------------- | |
| # Commit | |
| # --------------------------------------------------------------------------- | |
| function global:gc { git commit --verbose @args } | |
| function global:gcam { git commit --all --message @args } | |
| function global:gcb { git checkout -b @args } | |
| function global:gcf { git config --list @args } | |
| function global:gcl { git clone --recurse-submodules @args } | |
| function global:gcmsg { git commit --message @args } | |
| function global:gco { git checkout @args } | |
| function global:gcor { git checkout --recurse-submodules @args } | |
| function global:gcp { git cherry-pick @args } | |
| function global:gcpa { git cherry-pick --abort } | |
| function global:gcpc { git cherry-pick --continue } | |
| # --------------------------------------------------------------------------- | |
| # Diff | |
| # --------------------------------------------------------------------------- | |
| function global:gd { git diff @args } | |
| function global:gdca { git diff --cached @args } | |
| function global:gds { git diff --staged @args } | |
| function global:gdw { git diff --word-diff @args } | |
| # --------------------------------------------------------------------------- | |
| # Fetch | |
| # --------------------------------------------------------------------------- | |
| function global:gf { git fetch @args } | |
| function global:gfa { git fetch --all --prune @args } | |
| function global:gfo { git fetch origin @args } | |
| # --------------------------------------------------------------------------- | |
| # Log | |
| # --------------------------------------------------------------------------- | |
| function global:glg { git log --stat @args } | |
| function global:glgg { git log --graph @args } | |
| function global:glgga { git log --graph --decorate --all @args } | |
| function global:glo { git log --oneline --decorate @args } | |
| function global:glog { git log --oneline --decorate --graph @args } | |
| function global:gloga { git log --oneline --decorate --graph --all @args } | |
| function global:glol { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' @args } | |
| function global:glola { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all @args } | |
| function global:glols { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat @args } | |
| # --------------------------------------------------------------------------- | |
| # Merge | |
| # --------------------------------------------------------------------------- | |
| function global:gm { git merge @args } | |
| function global:gma { git merge --abort } | |
| function global:gmom { git merge "origin/$(git_main_branch)" @args } | |
| function global:gmum { git merge "upstream/$(git_main_branch)" @args } | |
| # --------------------------------------------------------------------------- | |
| # Pull | |
| # --------------------------------------------------------------------------- | |
| function global:gl { git pull @args } | |
| function global:ggpull { git pull origin "$(git_current_branch)" @args } | |
| function global:gpr { git pull --rebase @args } | |
| function global:gup { git pull --rebase @args } | |
| function global:gupv { git pull --rebase --verbose @args } | |
| function global:gupa { git pull --rebase --autostash @args } | |
| function global:gupav { git pull --rebase --autostash --verbose @args } | |
| # --------------------------------------------------------------------------- | |
| # Push | |
| # --------------------------------------------------------------------------- | |
| function global:gp { git push @args } | |
| function global:gpd { git push --dry-run @args } | |
| function global:gpf { git push --force-with-lease @args } | |
| function global:ggpush { git push origin "$(git_current_branch)" @args } | |
| function global:gpsup { git push --set-upstream origin "$(git_current_branch)" @args } | |
| function global:gpoat { git push origin --all; git push origin --tags } | |
| # --------------------------------------------------------------------------- | |
| # Rebase | |
| # --------------------------------------------------------------------------- | |
| function global:grb { git rebase @args } | |
| function global:grba { git rebase --abort } | |
| function global:grbc { git rebase --continue } | |
| function global:grbi { git rebase --interactive @args } | |
| function global:grbs { git rebase --skip } | |
| function global:grbm { git rebase "$(git_main_branch)" @args } | |
| function global:grbom { git rebase "origin/$(git_main_branch)" @args } | |
| # --------------------------------------------------------------------------- | |
| # Remote | |
| # --------------------------------------------------------------------------- | |
| function global:gr { git remote @args } | |
| function global:gra { git remote add @args } | |
| function global:grmv { git remote rename @args } | |
| function global:grrm { git remote remove @args } | |
| function global:grset { git remote set-url @args } | |
| function global:grup { git remote update @args } | |
| function global:grv { git remote --verbose @args } | |
| # --------------------------------------------------------------------------- | |
| # Reset | |
| # --------------------------------------------------------------------------- | |
| function global:grh { git reset @args } | |
| function global:grhh { git reset --hard @args } | |
| function global:gru { git reset -- @args } | |
| # --------------------------------------------------------------------------- | |
| # Restore | |
| # --------------------------------------------------------------------------- | |
| function global:grs { git restore @args } | |
| function global:grss { git restore --staged @args } | |
| function global:grst { git restore --staged --worktree @args } | |
| # --------------------------------------------------------------------------- | |
| # Show / Status | |
| # --------------------------------------------------------------------------- | |
| function global:gsh { git show @args } | |
| function global:gss { git status --short @args } | |
| function global:gsb { git status --short --branch @args } | |
| function global:gst { git status @args } | |
| function global:gs { git status @args } | |
| # --------------------------------------------------------------------------- | |
| # Stash | |
| # --------------------------------------------------------------------------- | |
| function global:gsta { git stash push @args } | |
| function global:gstaa { git stash apply @args } | |
| function global:gstc { git stash clear } | |
| function global:gstd { git stash drop @args } | |
| function global:gstl { git stash list @args } | |
| function global:gstp { git stash pop @args } | |
| function global:gsts { git stash show --text @args } | |
| function global:gstu { git stash push --include-untracked @args } | |
| # --------------------------------------------------------------------------- | |
| # Submodule | |
| # --------------------------------------------------------------------------- | |
| function global:gsi { git submodule init @args } | |
| function global:gsu { git submodule update @args } | |
| # --------------------------------------------------------------------------- | |
| # Switch | |
| # --------------------------------------------------------------------------- | |
| function global:gsw { git switch @args } | |
| function global:gswc { git switch -c @args } | |
| # --------------------------------------------------------------------------- | |
| # Tag | |
| # --------------------------------------------------------------------------- | |
| function global:gts { git tag --sign @args } | |
| function global:gtv { git tag | Sort-Object } | |
| # --------------------------------------------------------------------------- | |
| # Worktree | |
| # --------------------------------------------------------------------------- | |
| function global:gwt { git worktree @args } | |
| function global:gwta { git worktree add @args } | |
| function global:gwtl { git worktree list } | |
| function global:gwtp { git worktree prune @args } | |
| function global:gwtr { git worktree remove @args } | |
| # --------------------------------------------------------------------------- | |
| # Write-Host " git aliases loaded (omz)" -ForegroundColor DarkGray |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment