Skip to content

Instantly share code, notes, and snippets.

@danini-the-panini
Last active May 3, 2021 21:29
Show Gist options
  • Save danini-the-panini/6d9852bccc092133788cf9e7aeaacca0 to your computer and use it in GitHub Desktop.
Save danini-the-panini/6d9852bccc092133788cf9e7aeaacca0 to your computer and use it in GitHub Desktop.

Revisions

  1. danini-the-panini revised this gist May 3, 2021. 1 changed file with 25 additions and 1 deletion.
    26 changes: 25 additions & 1 deletion github_aliases.ps1
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,31 @@ Remove-Item alias:\gcm -Force
    Function gcm { git checkout master @Args }
    Function gcd { git checkout develop @Args }
    Function gcmsg { git commit -m @Args }
    Function gco { git checkout @Args }

    $getBranchesScriptBlock = {
    param($commandName, $parameterName, $stringMatch)

    git for-each-ref --format='%(refname:strip=2)' "refs/heads/$stringMatch*" "refs/heads/$stringMatch*/**" &&
    git for-each-ref --format='%(refname:strip=3)' "refs/remotes/*/$stringMatch*" "refs/remotes/*/$stringMatch*/**"
    }
    Function gco {
    [CmdletBinding()]
    param(
    [Parameter(Position = 0)]
    [string]$Branch,
    [Parameter()]
    [string]$b
    )
    if ("" -eq $b)
    {
    git checkout $Branch
    }
    else
    {
    git checkout -b $b
    }
    }
    Register-ArgumentCompleter -CommandName gco -ParameterName Branch -ScriptBlock $getBranchesScriptBlock
    Function gcount { git shortlog -sn @Args }
    Function gcp { git cherry-pick @Args }
    Function gcpa { git cherry-pick --abort @Args }
  2. Daniel Smith revised this gist Aug 3, 2020. 1 changed file with 133 additions and 126 deletions.
    259 changes: 133 additions & 126 deletions github_aliases.ps1
    Original file line number Diff line number Diff line change
    @@ -1,128 +1,135 @@
    Function current_branch { git rev-parse --abbrev-ref HEAD }
    Function ga { git add $args }
    Function gau { git add --update $args }
    Function gaa { git add --all $args }
    Function gapa { git add --patch $args }
    Function gb { git branch $args }
    Function gba { git branch -a $args }
    Function gbd { git branch -d $args }
    Function gbl { git blame -b -w $args }
    Function gbnm { git branch --no-merged $args }
    Function gbr { git branch --remote $args }
    Function gbs { git bisect $args }
    Function gbsb { git bisect bad $args }
    Function gbsg { git bisect good $args }
    Function gbsr { git bisect reset $args }
    Function gbss { git bisect start $args }
    Function gc { git commit -v $args }
    Function gc! { git commit -v --amend $args }
    Function gca { git commit -v -a $args }
    Function gca! { git commit -v -a --amend $args }
    Function gcan! { git commit -v -a --no-edit --amend $args }
    Function gcans! { git commit -v -a -s --no-edit --amend $args }
    Function gcam { git commit -a -m $args }
    Function gcsm { git commit -s -m $args }
    Function gcb { git checkout -b $args }
    Function gcf { git config --list $args }
    Function gcl { git clone --recurse-submodules $args }
    Function gclean { git clean -id $args }
    Function gpristine { git reset --hard; git clean -dffx $args }
    Function gcm { git checkout master $args }
    Function gcd { git checkout develop $args }
    Function gcmsg { git commit -m $args }
    Function gco { git checkout $args }
    Function gcount { git shortlog -sn $args }
    Function gcp { git cherry-pick $args }
    Function gcpa { git cherry-pick --abort $args }
    Function gcpc { git cherry-pick --continue $args }
    Function gcs { git commit -S $args }
    Function gd { git diff $args }
    Function gdca { git diff --cached $args }
    Function gdct { git describe --tags $(git rev-list --tags --max-count=1) $args }
    Function gds { git diff --staged $args }
    Function gdt { git diff-tree --no-commit-id --name-only -r $args }
    Function gdw { git diff --word-diff $args }
    Function gf { git fetch $args }
    Function gfa { git fetch --all --prune $args }
    Function gfo { git fetch origin $args }
    Function gg { git gui citool $args }
    Function gga { git gui citool --amend $args }
    Function ggpnp { git pull origin $(current_branch); git push origin $(current_branch) $args }
    Function ggpull { git pull origin $(current_branch) $args }
    Function ggl { git pull origin $(current_branch) $args }
    Function ggpur { git pull --rebase origin $(current_branch) $args }
    Function ggu { git pull --rebase origin $(current_branch) $args }
    Function glum { git pull upstream master $args }
    Function ggpush { git push origin $(current_branch) $args }
    Function ggp { git push origin $(current_branch) $args }
    Function ggfl { git push --force-with-lease origin $args[0]/$(current_branch) }
    Function ggsup { git branch --set-upstream-to=origin/$(current_branch) $args }
    Function gpsup { git push --set-upstream origin $(current_branch) $args }
    Function ghh { git help $args }
    Function gignore { git update-index --assume-unchanged $args }
    Function gignored { git ls-files -v $args }
    Function gk { \gitk --all --branches $args }
    Function gke { \gitk --all $(git log -g --pretty=%h) $args }
    Function gl { git pull $args }
    Function glg { git log --stat $args }
    Function glgg { git log --graph $args }
    Function glgga { git log --graph --decorate --all $args }
    Function glgm { git log --graph --max-count=10 $args }
    Function glgp { git log --stat -p $args }
    Function glo { git log --oneline --decorate $args }
    Function glog { git log --oneline --decorate --graph $args }
    Function glol { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' $args }
    Function glola { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --all $args }
    Function glp { _git_log_prettily (Also: "git log --pretty=$1") $args }
    Function gm { git merge $args }
    Function gma { git merge --abort $args }
    Function gmom { git merge origin/master $args }
    Function gmt { git mergetool --no-prompt $args }
    Function gmtvim { git mergetool --no-prompt --tool=vimdiff $args }
    Function gmum { git merge upstream/master $args }
    Function gp { git push $args }
    Function gpd { git push --dry-run $args }
    Function gpoat { git push origin --all; git push origin --tags $args }
    Function gpu { git push upstream $args }
    Function gpv { git push -v $args }
    Function gr { git remote $args }
    Function gra { git remote add $args }
    Function grb { git rebase $args }
    Function grba { git rebase --abort $args }
    Function grbc { git rebase --continue $args }
    Function grbd { git rebase develop $args }
    Function grbi { git rebase -i $args }
    Function grbm { git rebase master $args }
    Function grbs { git rebase --skip $args }
    Function grh { git reset (Also: "git reset HEAD") $args }
    Function grhh { git reset --hard (Also: "git reset HEAD --hard") $args }
    Function grmv { git remote rename $args }
    Function grrm { git remote remove $args }
    Function grs { git restore $args }
    Function grset { git remote set-url $args }
    Function ga { git add @Args }
    Function gau { git add --update @Args }
    Function gaa { git add --all @Args }
    Function gapa { git add --patch @Args }
    Function gb { git branch @Args }
    Function gba { git branch -a @Args }
    Function gbd { git branch -d @Args }
    Function gbl { git blame -b -w @Args }
    Function gbnm { git branch --no-merged @Args }
    Function gbr { git branch --remote @Args }
    Function gbs { git bisect @Args }
    Function gbsb { git bisect bad @Args }
    Function gbsg { git bisect good @Args }
    Function gbsr { git bisect reset @Args }
    Function gbss { git bisect start @Args }
    Remove-Item alias:\gc -Force
    Function gc { git commit -v @Args }
    Function gc! { git commit -v --amend @Args }
    Function gca { git commit -v -a @Args }
    Function gca! { git commit -v -a --amend @Args }
    Function gcan! { git commit -v -a --no-edit --amend @Args }
    Function gcans! { git commit -v -a -s --no-edit --amend @Args }
    Function gcam { git commit -a -m @Args }
    Function gcsm { git commit -s -m @Args }
    Remove-Item alias:\gcb -Force
    Function gcb { git checkout -b @Args }
    Function gcf { git config --list @Args }
    Function gcl { git clone --recurse-submodules @Args }
    Function gclean { git clean -id @Args }
    Function gpristine { git reset --hard; git clean -dffx @Args }
    Remove-Item alias:\gcm -Force
    Function gcm { git checkout master @Args }
    Function gcd { git checkout develop @Args }
    Function gcmsg { git commit -m @Args }
    Function gco { git checkout @Args }
    Function gcount { git shortlog -sn @Args }
    Function gcp { git cherry-pick @Args }
    Function gcpa { git cherry-pick --abort @Args }
    Function gcpc { git cherry-pick --continue @Args }
    Remove-Item alias:\gcs -Force
    Function gcs { git commit -S @Args }
    Function gd { git diff @Args }
    Function gdca { git diff --cached @Args }
    Function gdct { git describe --tags $(git rev-list --tags --max-count=1) @Args }
    Function gds { git diff --staged @Args }
    Function gdt { git diff-tree --no-commit-id --name-only -r @Args }
    Function gdw { git diff --word-diff @Args }
    Function gf { git fetch @Args }
    Function gfa { git fetch --all --prune @Args }
    Function gfo { git fetch origin @Args }
    Function gg { git gui citool @Args }
    Function gga { git gui citool --amend @Args }
    Function ggpnp { git pull origin $(current_branch); git push origin $(current_branch) @Args }
    Function ggpull { git pull origin $(current_branch) @Args }
    Function ggl { git pull origin $(current_branch) @Args }
    Function ggpur { git pull --rebase origin $(current_branch) @Args }
    Function ggu { git pull --rebase origin $(current_branch) @Args }
    Function glum { git pull upstream master @Args }
    Function ggpush { git push origin $(current_branch) @Args }
    Function ggp { git push origin $(current_branch) @Args }
    Function ggfl { git push --force-with-lease origin $Args[0]/$(current_branch) }
    Function ggsup { git branch --set-upstream-to=origin/$(current_branch) @Args }
    Function gpsup { git push --set-upstream origin $(current_branch) @Args }
    Function ghh { git help @Args }
    Function gignore { git update-index --assume-unchanged @Args }
    Function gignored { git ls-files -v @Args }
    Function gk { \gitk --all --branches @Args }
    Function gke { \gitk --all $(git log -g --pretty=%h) @Args }
    Remove-Item alias:\gl -Force
    Function gl { git pull @Args }
    Function glg { git log --stat @Args }
    Function glgg { git log --graph @Args }
    Function glgga { git log --graph --decorate --all @Args }
    Function glgm { git log --graph --max-count=10 @Args }
    Function glgp { git log --stat -p @Args }
    Function glo { git log --oneline --decorate @Args }
    Function glog { git log --oneline --decorate --graph @Args }
    Function glol { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' @Args }
    Function glola { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --all @Args }
    Function glp { _git_log_prettily (Also: "git log --pretty=$1") @Args }
    Remove-Item alias:\gm -Force
    Function gm { git merge @Args }
    Function gma { git merge --abort @Args }
    Function gmom { git merge origin/master @Args }
    Function gmt { git mergetool --no-prompt @Args }
    Function gmtvim { git mergetool --no-prompt --tool=vimdiff @Args }
    Function gmum { git merge upstream/master @Args }
    Remove-Item alias:\gp -Force
    Function gp { git push @Args }
    Function gpd { git push --dry-run @Args }
    Function gpoat { git push origin --all; git push origin --tags @Args }
    Function gpu { git push upstream @Args }
    Function gpv { git push -v @Args }
    Function gr { git remote @Args }
    Function gra { git remote add @Args }
    Function grb { git rebase @Args }
    Function grba { git rebase --abort @Args }
    Function grbc { git rebase --continue @Args }
    Function grbd { git rebase develop @Args }
    Function grbi { git rebase -i @Args }
    Function grbm { git rebase master @Args }
    Function grbs { git rebase --skip @Args }
    Function grh { git reset (Also: "git reset HEAD") @Args }
    Function grhh { git reset --hard (Also: "git reset HEAD --hard") @Args }
    Function grmv { git remote rename @Args }
    Function grrm { git remote remove @Args }
    Function grs { git restore @Args }
    Function grset { git remote set-url @Args }
    Function grt { Set-Location $((git rev-parse --show-toplevel) -OR (".")) }
    Function gru { git reset -- $args }
    Function grup { git remote update $args }
    Function grv { git remote -v $args }
    Function gsb { git status -sb $args }
    Function gsd { git svn dcommit $args }
    Function gsi { git submodule init $args }
    Function gsps { git show --pretty=short --show-signature $args }
    Function gsr { git svn rebase $args }
    Function gss { git status -s $args }
    Function gst { git status $args }
    Function gsta { git stash save $args }
    Function gstaa { git stash apply $args }
    Function gstd { git stash drop $args }
    Function gstl { git stash list $args }
    Function gstp { git stash pop $args }
    Function gstc { git stash clear $args }
    Function gsts { git stash show --text $args }
    Function gsu { git submodule update $args }
    Function gts { git tag -s $args }
    Function gunignore { git update-index --no-assume-unchanged $args }
    Function gunwip { git log -n 1 | grep -q -c "--wip--"; git reset HEAD~1 $args }
    Function gup { git pull --rebase $args }
    Function gupv { git pull --rebase -v $args }
    Function gvt { git verify-tag $args }
    Function gwch { git whatchanged -p --abbrev-commit --pretty=medium $args }
    Function gru { git reset -- @Args }
    Function grup { git remote update @Args }
    Function grv { git remote -v @Args }
    Function gsb { git status -sb @Args }
    Function gsd { git svn dcommit @Args }
    Function gsi { git submodule init @Args }
    Function gsps { git show --pretty=short --show-signature @Args }
    Function gsr { git svn rebase @Args }
    Function gss { git status -s @Args }
    Function gst { git status @Args }
    Function gsta { git stash save @Args }
    Function gstaa { git stash apply @Args }
    Function gstd { git stash drop @Args }
    Function gstl { git stash list @Args }
    Function gstp { git stash pop @Args }
    Function gstc { git stash clear @Args }
    Function gsts { git stash show --text @Args }
    Function gsu { git submodule update @Args }
    Function gts { git tag -s @Args }
    Function gunignore { git update-index --no-assume-unchanged @Args }
    Function gunwip { git log -n 1 | grep -q -c "--wip--"; git reset HEAD~1 @Args }
    Function gup { git pull --rebase @Args }
    Function gupv { git pull --rebase -v @Args }
    Function gvt { git verify-tag @Args }
    Function gwch { git whatchanged -p --abbrev-commit --pretty=medium @Args }
  3. Daniel Smith created this gist Jul 22, 2020.
    128 changes: 128 additions & 0 deletions github_aliases.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,128 @@
    Function current_branch { git rev-parse --abbrev-ref HEAD }
    Function ga { git add $args }
    Function gau { git add --update $args }
    Function gaa { git add --all $args }
    Function gapa { git add --patch $args }
    Function gb { git branch $args }
    Function gba { git branch -a $args }
    Function gbd { git branch -d $args }
    Function gbl { git blame -b -w $args }
    Function gbnm { git branch --no-merged $args }
    Function gbr { git branch --remote $args }
    Function gbs { git bisect $args }
    Function gbsb { git bisect bad $args }
    Function gbsg { git bisect good $args }
    Function gbsr { git bisect reset $args }
    Function gbss { git bisect start $args }
    Function gc { git commit -v $args }
    Function gc! { git commit -v --amend $args }
    Function gca { git commit -v -a $args }
    Function gca! { git commit -v -a --amend $args }
    Function gcan! { git commit -v -a --no-edit --amend $args }
    Function gcans! { git commit -v -a -s --no-edit --amend $args }
    Function gcam { git commit -a -m $args }
    Function gcsm { git commit -s -m $args }
    Function gcb { git checkout -b $args }
    Function gcf { git config --list $args }
    Function gcl { git clone --recurse-submodules $args }
    Function gclean { git clean -id $args }
    Function gpristine { git reset --hard; git clean -dffx $args }
    Function gcm { git checkout master $args }
    Function gcd { git checkout develop $args }
    Function gcmsg { git commit -m $args }
    Function gco { git checkout $args }
    Function gcount { git shortlog -sn $args }
    Function gcp { git cherry-pick $args }
    Function gcpa { git cherry-pick --abort $args }
    Function gcpc { git cherry-pick --continue $args }
    Function gcs { git commit -S $args }
    Function gd { git diff $args }
    Function gdca { git diff --cached $args }
    Function gdct { git describe --tags $(git rev-list --tags --max-count=1) $args }
    Function gds { git diff --staged $args }
    Function gdt { git diff-tree --no-commit-id --name-only -r $args }
    Function gdw { git diff --word-diff $args }
    Function gf { git fetch $args }
    Function gfa { git fetch --all --prune $args }
    Function gfo { git fetch origin $args }
    Function gg { git gui citool $args }
    Function gga { git gui citool --amend $args }
    Function ggpnp { git pull origin $(current_branch); git push origin $(current_branch) $args }
    Function ggpull { git pull origin $(current_branch) $args }
    Function ggl { git pull origin $(current_branch) $args }
    Function ggpur { git pull --rebase origin $(current_branch) $args }
    Function ggu { git pull --rebase origin $(current_branch) $args }
    Function glum { git pull upstream master $args }
    Function ggpush { git push origin $(current_branch) $args }
    Function ggp { git push origin $(current_branch) $args }
    Function ggfl { git push --force-with-lease origin $args[0]/$(current_branch) }
    Function ggsup { git branch --set-upstream-to=origin/$(current_branch) $args }
    Function gpsup { git push --set-upstream origin $(current_branch) $args }
    Function ghh { git help $args }
    Function gignore { git update-index --assume-unchanged $args }
    Function gignored { git ls-files -v $args }
    Function gk { \gitk --all --branches $args }
    Function gke { \gitk --all $(git log -g --pretty=%h) $args }
    Function gl { git pull $args }
    Function glg { git log --stat $args }
    Function glgg { git log --graph $args }
    Function glgga { git log --graph --decorate --all $args }
    Function glgm { git log --graph --max-count=10 $args }
    Function glgp { git log --stat -p $args }
    Function glo { git log --oneline --decorate $args }
    Function glog { git log --oneline --decorate --graph $args }
    Function glol { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' $args }
    Function glola { git log --graph --pretty=\'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --all $args }
    Function glp { _git_log_prettily (Also: "git log --pretty=$1") $args }
    Function gm { git merge $args }
    Function gma { git merge --abort $args }
    Function gmom { git merge origin/master $args }
    Function gmt { git mergetool --no-prompt $args }
    Function gmtvim { git mergetool --no-prompt --tool=vimdiff $args }
    Function gmum { git merge upstream/master $args }
    Function gp { git push $args }
    Function gpd { git push --dry-run $args }
    Function gpoat { git push origin --all; git push origin --tags $args }
    Function gpu { git push upstream $args }
    Function gpv { git push -v $args }
    Function gr { git remote $args }
    Function gra { git remote add $args }
    Function grb { git rebase $args }
    Function grba { git rebase --abort $args }
    Function grbc { git rebase --continue $args }
    Function grbd { git rebase develop $args }
    Function grbi { git rebase -i $args }
    Function grbm { git rebase master $args }
    Function grbs { git rebase --skip $args }
    Function grh { git reset (Also: "git reset HEAD") $args }
    Function grhh { git reset --hard (Also: "git reset HEAD --hard") $args }
    Function grmv { git remote rename $args }
    Function grrm { git remote remove $args }
    Function grs { git restore $args }
    Function grset { git remote set-url $args }
    Function grt { Set-Location $((git rev-parse --show-toplevel) -OR (".")) }
    Function gru { git reset -- $args }
    Function grup { git remote update $args }
    Function grv { git remote -v $args }
    Function gsb { git status -sb $args }
    Function gsd { git svn dcommit $args }
    Function gsi { git submodule init $args }
    Function gsps { git show --pretty=short --show-signature $args }
    Function gsr { git svn rebase $args }
    Function gss { git status -s $args }
    Function gst { git status $args }
    Function gsta { git stash save $args }
    Function gstaa { git stash apply $args }
    Function gstd { git stash drop $args }
    Function gstl { git stash list $args }
    Function gstp { git stash pop $args }
    Function gstc { git stash clear $args }
    Function gsts { git stash show --text $args }
    Function gsu { git submodule update $args }
    Function gts { git tag -s $args }
    Function gunignore { git update-index --no-assume-unchanged $args }
    Function gunwip { git log -n 1 | grep -q -c "--wip--"; git reset HEAD~1 $args }
    Function gup { git pull --rebase $args }
    Function gupv { git pull --rebase -v $args }
    Function gvt { git verify-tag $args }
    Function gwch { git whatchanged -p --abbrev-commit --pretty=medium $args }