Last active
May 27, 2022 20:31
-
-
Save GiriB/73329bd05ab0e906350ec484c63e33a0 to your computer and use it in GitHub Desktop.
Powershell shortcuts for Git
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
echo "wow... loading your aliases GGB" | |
alias gita='git add' | |
alias gitc='git commit -m' | |
alias gits='git status' | |
alias gitba='git branch -a' | |
alias gitl='git log' | |
alias gitd='git diff' | |
alias gitcm='git checkout master' | |
alias gitp='git pull' | |
alias gitpp='git push' | |
alias cde='cd ~/Desktop/' | |
alias cdd='cd ~/Downloads/' | |
alias cw='cd ~/workspace/' | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " | |
# If you see uncomfortable ls directory output colors https://askubuntu.com/a/466203/357761 | |
# LS_COLORS=$LS_COLORS:'di=1;44:' ; export LS_COLORS | |
# LS_COLORS=$LS_COLORS:'tw=01;35:ow=01;35:' ; export LS_COLORS | |
git config --global color.status.untracked "red bold" | |
git config --global color.status.changed "red bold" |
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
# Install it first - https://github.com/dahlbyk/posh-git#installing-posh-git-via-powershellget-on-linux-macos-and-windows | |
Import-Module posh-git | |
function gitgraph(){ | |
git log --all --decorate --online -- graph | |
} | |
function gitconflict(){ | |
git diff --name-only --diff-filter=U | |
} | |
# git commit | |
function gitc() { | |
git commit --verbose --message $args[0] | |
} | |
# git branch and remote | |
function gitba() { | |
git branch -a | |
} | |
# git add | |
function gita() { | |
git add $args.split(' ') | |
} | |
# git diff | |
function gitd() { | |
git diff $args[0] | |
} | |
# git status | |
function gits() { | |
git status | |
} | |
# git log | |
function gitl() { | |
git log | |
} | |
# cd Desktop | |
function cde(){ | |
cd ~/Desktop | |
} | |
# cd Downloads | |
function cdd(){ | |
cd ~/Downloads | |
} | |
# go to workspace | |
function cw(){ | |
cd E:\workspace | |
} | |
function gitcm(){ | |
git checkout master | |
} | |
function gitp(){ | |
git pull | |
} | |
function gitpp(){ | |
git push | |
} | |
function which(){ | |
get-command $args[0] | Format-Table Path, Name | |
} | |
#word count | |
function wc(){ | |
Measure-Object $args[0] | |
} | |
# setting git color | |
git config --global color.status.untracked "red bold" | |
git config --global color.status.changed "red bold" | |
# sublime | |
$Env:PAth = $Env:Path+";C:\Program Files\Sublime Text 3" | |
#adding indivisual folders. Windows PATH resolution does not work recursively | |
$Env:PAth = $Env:Path+";C:\Users\gibhatna\AppData\Local\Programs\Python\Python37;C:\Users\gibhatna\AppData\Local\Programs\Python\Python37\Scripts" | |
$Env:Path = $Env:Path+";C:\Users\gibhatna\external\Drop.App\lib\net45" | |
#to make the color brighter ref:https://learn-powershell.net/2012/08/07/make-your-powershell-errors-less-harsh-by-changing-their-color/ | |
$host.PrivateData.ErrorForegroundColor = 'Red'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment