Skip to content

Instantly share code, notes, and snippets.

@ethyde
Last active November 24, 2016 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethyde/6d83001b566dee612eda1cf3bcdd7944 to your computer and use it in GitHub Desktop.
Save ethyde/6d83001b566dee612eda1cf3bcdd7944 to your computer and use it in GitHub Desktop.
Git Config files
#!/bin/bash
alias g='git'
alias gs='git status'
#!/bin/bash
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# https://gist.github.com/kevbost/3109ba166f612bd8b86e53539eede5d6/
# Normal Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
NC="\e[m" # Color Reset
ALERT=${BWhite}${On_Red} # Bold White on red background
# Navigate to Workspace/, Display welcome message
cd /i/wamp/www/
clear && echo -e "${Cyan}\nHi Manu.\n\nWelcome back to bash.\e[5;32;47m"
echo -e "${Yellow}\n`date`.\e[5;32;47m${NC}"
alias workspace="cd /i/wamp/www/"
alias ws=workspace
alias beautiful="clear && echo -e '${Cyan}\nI dont appreciate your sarcasm . . .' && sleep 1 && exit"
alias perfect="echo -e '${Cyan}\nNo, YOURE perfect. . .'"
alias damnit="echo -e '${BRed}\nUh oh. . . did you try googling it?'"
alias no="echo -e '${BRed}\nDude, just google it.'"
alias okay="echo -e '${BRed}\nGreat, bye felicia' && sleep 2 && exit"
alias awesome="echo -e '${BRed}\nI dont appreciate your sarcasm' && sleep 2 && exit"
alias reload=". ~/.bash_profile"
#!/bin/bash
# from : https://www.schoonology.com/technology/ssh-agent-windows/
# SSH Agent
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
if [ "$SSH_AUTH_SOCK" ]; then
# ssh-add returns:
# 0 = agent running, has keys
# 1 = agent running, no keys
# 2 = agent not running
ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]
else
false
fi
}
agent_has_keys() {
ssh-add -l >/dev/null 2>&1
}
agent_load_env() {
. "$env" >/dev/null
}
agent_start() {
(umask 077; ssh-agent >"$env")
. "$env" >/dev/null
}
# adding every id_rsa_* SSH key in my ~/.ssh folder.
add_all_keys() {
ls ~/.ssh | grep id_rsa[^.]*$ | sed "s:^:`echo ~`/.ssh/:" | xargs -n 1 ssh-add
}
if ! agent_is_running; then
agent_load_env
fi
# if your keys are not stored in ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub, you'll need
# to paste the proper path after ssh-add
if ! agent_is_running; then
agent_start
add_all_keys
elif ! agent_has_keys; then
add_all_keys
fi
echo `ssh-add -l | wc -l` SSH keys registered.
unset env
# use gitconfig alias like bash_alias https://gist.github.com/mwhite/6887990
# look for add git completion https://www.narga.net/helpful-hints-tips-tricks-mastering-git-github/
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
function_exists() {
declare -f -F $1 > /dev/null
return $?
}
for al in `__git_aliases`; do
alias g$al="git $al"
complete_func=_git_$(__git_aliased_command $al)
function_exists $complete_fnc && __git_complete g$al $complete_func
done
# load bash alias
source I:\\wamp\\www\\LABS\\githooks\\.bash_alias
# https://gist.github.com/pksunkara/988716
# http://www.git-attitude.fr/2013/04/03/configuration-git/
[user]
name = Ethyde
email = ethyde@____.fr
[core]
editor = code --wait
hooksPath = I:\\wamp\\www\\LABS\\githooks
excludesfile = I:\\wamp\\www\\LABS\\githooks\\.gitignore_global
# Don't consider trailing space change as a cause for merge conflicts
whitespace = -trailing-space
[credential]
helper = store
[commit]
template = I:\\wamp\\www\\LABS\\githooks\\.gitmessage
status = false # remove default commit msg
[diff]
# Use better, descriptive initials (c, i, w) instead of a/b.
# c for Commit (generaly HEAD)
# i for Index (stage)
# w for Working directory
mnemonicPrefix = true
# define default-difftool has diff tool.
tool = default-difftool
# When using --word-diff, assume --word-diff-regex=.
wordRegex = .
[push]
# Default push should only push the current branch to its push target, regardless of its remote name
default = upstream
[difftool "default-difftool"]
# use VScode has difftool
cmd = code --wait --diff $LOCAL $REMOTE
[color]
ui = auto
[color "branch"]
current = yellow bold
local = green bold
remote = cyan bold
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = green bold
changed = yellow bold
untracked = red bold
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag = v
[merge]
# Display common-ancestor blocks in conflict hunks
conflictStyle = diff3
[log]
# Use abbrev SHAs whenever possible/relevant instead of full 40 chars
abbrevCommit = true
[alias] # use tag to indent
a = add
aa = add --all
ai = add --interactive
###### test #######
b = branch
ba = branch --all
bd = branch --delete
bm = branch --move
#############
co = checkout
cob = checkout -b
#############
c = commit
ca = commit --amend
#############
d = diff
dt = difftool
dcw = diff --color-words
dwd = diff --word-diff
#############
f = fetch
fo = fetch origin
fu = fetch upstream
#############
la = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
#############
lg = log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
#############
m = merge
ma = merge --abort
mc = merge --continue
ms = merge --skip
#############
pr = prune -v
#############
ps = push
pso = push origin
#############
pl = pull
plr = pull --rebase
plo = pull origin
#############
rb = rebase
rba = rebase --abort
rbc = rebase --continue
rbi = rebase --interactive
rbs = rebase --skip
#############
re = reset
rh = reset HEAD
reh = reset --hard
rem = reset --mixed
res = reset --soft
rehh = reset --hard HEAD
remh = reset --mixed HEAD
resh = reset --soft HEAD
#############
s = status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment