Loading Start Scripts for GitBash on Windows
I use GitBash as my shell on Windows. Below are the scripts I normally load including git ssh agent.
# ~/.bash_profile test -f ~/.profile && . ~/.profile test -f ~/.bashrc && . ~/.bashrc test -f ~/.bash_aliases && . ~/.bash_aliases
# ~/.bashrc env=~/.ssh/agent.env agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } agent_start () { (umask 077; ssh-agent >| "$env") . "$env" >| /dev/null ; } agent_load_env # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then agent_start ssh-add ~/.ssh/id_rsa_git elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then ssh-add ~/.ssh/id_rsa_git fi unset env
# ~/.ssh/agent.env SSH_AUTH_SOCK=/c/Users/Public/Documents/Wondershare/CreatorTemp/ssh-VmJtrCgHYMK8/agent.12228; export SSH_AUTH_SOCK; SSH_AGENT_PID=9836; export SSH_AGENT_PID; echo Agent pid 9836;
Useful git aliases:
# ~/.bash_aliases alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gs="git status" alias gcm="git checkout master" alias glog5="git log --oneline -5" alias gamendn="git commit --amend --no-edit" alias gamend="git commit --amend" alias glog5pretty="git log --pretty=format:\"%h%x09%an%x09%ad%x09%s\" -5" alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias wip="git add . && git commit -m 'wip'" alias nah="git reset --hard && git clean -df" #changing git ssh key alias ghswitchalex="ssh-add -D && ssh-add ~/.ssh/id_rsa_git && ssh -T git@github.com" alias ghwhoami="ssh -T git@github.com"