added git settings, including git aliases taken from https://github.com/garybernhardt/dotfiles/

This commit is contained in:
2012-06-01 10:26:27 -07:00
parent 526ce49b7c
commit 8c69a53cbe
4 changed files with 86 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
alias gs='git status' alias gs='git status'
alias ga='git add' alias ga='git add'
alias gaa='git add --all'
alias gu='git add -u' alias gu='git add -u'
alias gc='git commit -v' alias gc='git commit -v'
alias gca='git commit -v -a' alias gca='git commit -v -a'
@@ -10,3 +11,4 @@ alias gb='git branch'
alias gco='git checkout' alias gco='git checkout'
alias gr='git remote' alias gr='git remote'
alias gd='git diff' alias gd='git diff'
alias gph='git push heroku'

32
git/gitconfig Normal file
View File

@@ -0,0 +1,32 @@
[diff]
[color]
ui = auto
[alias]
st = status
ci = commit
co = checkout
di = diff
dc = diff --cached
amend = commit --amend
aa = add --all
ff = merge --ff-only
pullff = pull --ff-only
noff = merge --no-ff
div = divergence
gn = goodness
gnc = goodness --cached
fa = fetch --all
pom = push origin master
b = branch
ds = diff --stat=160,120
dh1 = diff HEAD~1
head = !git l -1
h = !git head
hp = "!source ~/.githelpers && show_git_head"
r = !git l -30
ra = !git r --all
l = "!source ~/.githelpers && pretty_git_log"
la = !git l --all
[merge]
tool = vimdiff

40
git/githelpers Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# Log output:
#
# * 51c333e (12 days) <Gary Bernhardt> add vim-eunuch
#
# The time massaging regexes start with ^[^<]* because that ensures that they
# only operate before the first "<". That "<" will be the beginning of the
# author name, ensuring that we don't destroy anything in the commit message
# that looks like time.
#
# The log format uses } characters between each field, and `column` is later
# used to split on them. A } in the commit subject or any other field will
# break this.
HASH="%C(yellow)%h%Creset"
RELATIVE_TIME="%Cgreen(%ar)%Creset"
AUTHOR="%C(bold blue)<%an>%Creset"
REFS="%C(red)%d%Creset"
SUBJECT="%s"
FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"
show_git_head() {
pretty_git_log -1
git show -p --pretty="tformat:"
}
pretty_git_log() {
git log --graph --pretty="tformat:${FORMAT}" $* |
# Replace (2 years ago) with (2 years)
sed -Ee 's/(^[^<]*) ago)/\1)/' |
# Replace (2 years, 5 months) with (2 years)
sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?)/\1)/' |
# Line columns up based on } delimiter
column -s '}' -t |
# Page only if we need to
less -FXRS
}

View File

@@ -21,7 +21,7 @@ fi
ROOT=`pwd` ROOT=`pwd`
### ###
# bash_magic # bash
### ###
#clone repo #clone repo
$GIT clone https://github.com/Knewton/bash_magic.git bash/bash_magic $GIT clone https://github.com/Knewton/bash_magic.git bash/bash_magic
@@ -47,6 +47,17 @@ if [ ! -f "${HOME}"/.bashrc ]; then
ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc
fi fi
###
# git
###
echo -n "Enter your git name: "
read NAME
echo -n "Enter you git email: "
read EMAIL
echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig
cat git/gitconfig >> "${HOME}"/.gitconfig
cp git/githelpers "${HOME}"/.githelpers
### ###
# vim # vim
### ###