-
-
Save jbaxleyiii/9e02b3587ff6b9b6b0b0d39f2e635e74 to your computer and use it in GitHub Desktop.
Few simple commands/aliases for git in powershell. installation save as for ex.: C:\gitcommands.ps1
open powershell
type:
notepad $profile
add line:
. "C:\gitcommands.ps1"
close shell
This file contains 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
function g { | |
$newArgs=$args[1..($args.Length-1)] | |
if ($args[0] -eq "ci") { | |
git commit $newArgs | |
} elseif ($args[0] -eq "hof") { | |
git shortlog -n -s --no-merges | |
} elseif ($args[0] -eq "cic") { | |
git commit --amend | |
} elseif ($args[0] -eq "snake") { | |
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative | |
} elseif ($args[0] -eq "nuke") { | |
git reset --hard $newArgs | |
} else { | |
git $args | |
} | |
} | |
function gdump { | |
git stash save $args | |
} | |
function gdig { | |
git stash pop $args | |
} | |
function gsup { | |
git submodule update --init | |
} | |
function gup { | |
git pull --summary $args | |
gsup | |
} | |
function greup { | |
gdump --all -u -q | |
git pull --summary --rebase $args | |
gsup | |
gdig -q | |
} | |
function go { | |
git checkout $args | |
gsup | |
} | |
function grate { | |
git review -d $args | |
gsup | |
} | |
function grev { | |
git review $args | |
} | |
function gr { | |
git rebase $args | |
} | |
function gloc { | |
git log --oneline --decorate $args | |
} | |
echo "" | |
echo "Git additional commands and aliases:" | |
echo "" | |
echo " g - git alias" | |
echo " g ci - git comit" | |
echo " g nuke - git reset --hard" | |
echo " g snake - git log graph" | |
echo " g hof - The Git Hall of Fame :D" | |
echo " gdump - git stash all" | |
echo " gdig - git stash pop" | |
echo " gup - git pull (!from repo base dir)" | |
echo " greup - stash add, pull with rebase, stash pop (!from repo base dir)" | |
echo " gsup - submodule update (!from repo base dir)" | |
echo " go - git checkout (!from repo base dir)" | |
echo " grev - git review" | |
echo " grate - git review -d [id]" | |
echo " gr - git rebase" | |
echo " gloc - git log --oneline --decorate" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment