Skip to content

Instantly share code, notes, and snippets.

@lonelydev
Created May 24, 2021 20:46
Show Gist options
  • Save lonelydev/087c63fd7f1c56f9f5e4d9778216a78a to your computer and use it in GitHub Desktop.
Save lonelydev/087c63fd7f1c56f9f5e4d9778216a78a to your computer and use it in GitHub Desktop.
configuration for git and git-bash
( )
( )
( )
( )
) )
( ( /\
(_) / \ /\
________[_]________ /\/ \/ \
/\ /\ ______ \ / /\/\ /\/\
/ \ //_\ \ /\ \ /\/\/ \/ \
/\ / /\/\ //___\ \__/ \ \/
/ \ /\/ \//_____\ \ |[]| \
/\/\/\/ //_______\ \|__| \
/ \ /XXXXXXXXXX\ \
\ /_I_II I__I_\__________________\
I_I| I__I_____[]_|_[]_____I
I_II I__I_____[]_|_[]_____I
I II__I I XXXXXXX I
~~~~~" "~~~~~~~~~~~~~~~~~~~~~~~~
Welcome Home
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
alias ee='code'
alias ll='ls -lh --color'
alias ls='ls --color'
if [ -n "$INSIDE_EMACS" ]; then
export PS1='\[\033[32m\][\D{%F %T}]\[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
else
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
redColour=$(tput setaf 1)
blueColour=$(tput setaf 4)
cyanColour=$(tput setaf 6)
greenColour=$(tput setaf 2)
colorReset=$(tput sgr0)
#source ~/.config/.git-prompt.sh
#\h is host name, which is always going to be egopalakrishpc anyway
#\u is your username, and you know it is you anwyay
PS1="\[$redColour\][\D{%F %T}]\[$blueColour\][\w]\[$cyanColour\]\[$greenColour\]\$(__git_ps1)\[$colorReset\]> "
PROMPT_COMMAND='echo -n -e "\033k\033\0134"'
shopt -s checkwinsize
fi
# solarized dark
echo -ne '\e]4;0;#073642\a' # black
echo -ne '\e]4;1;#dc322f\a' # red
echo -ne '\e]4;2;#859900\a' # green
echo -ne '\e]4;3;#b58900\a' # yellow
echo -ne '\e]4;4;#268bd2\a' # blue
echo -ne '\e]4;5;#d33682\a' # magenta
echo -ne '\e]4;6;#2aa198\a' # cyan
echo -ne '\e]4;7;#eee8d5\a' # white (light grey really)
echo -ne '\e]4;8;#002b36\a' # bold black (i.e. dark grey)
echo -ne '\e]4;9;#cb4b16\a' # bold red
echo -ne '\e]4;10;#586e75\a' # bold green
echo -ne '\e]4;11;#657b83\a' # bold yellow
echo -ne '\e]4;12;#839496\a' # bold blue
echo -ne '\e]4;13;#6c71c4\a' # bold magenta
echo -ne '\e]4;14;#93a1a1\a' # bold cyan
echo -ne '\e]4;15;#fdf6e3\a' # bold white
echo -ne '\e]10;#eee8d5\a' # foreground
echo -ne '\e]11;#002b36\a' # background
echo -ne '\e]12;#859900\a' # cursor
cat ~/.asci_home
[alias]
# log of recent commits aliases
dl = "!git ll -1"
dlc = diff --cached HEAD^
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { git ll "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
# find your files
f = "!git ls-files | grep -i"
gr = grep -Ii
# display aliases on command line
la = "!git config -l | grep alias | cut -c 7-"
# Rename [branch] to done-[branch]
# If I wanted to quickly rename branches prepending done- to their names.
# Here is the alias that came out of that workflow:
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
# most useful shortcuts
cp = cherry-pick
st = status -s
cl = clone
ci = commit
co = checkout
br = branch
diff = diff --word-diff
dc = diff --cached
# stash operations
sl = stash list
sa = stash apply
ss = stash save
# git reset commands
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# all types of log aliases
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
fl = log -u
lg = log --oneline --graph --decorate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment