update(2013/8/22):
git config user.email "[email protected]"
update(2010/9/8):
git config --global core.editor "vim"
or set the VISUAL or EDITOR environment variables.
export VISUAL=vim
export EDITOR=vim
Terminal 下不同类型的文件显示不同的颜色
Terminal 默认的 shell 是 bash (提示符是 $)
在 ~ 先建立一个文件 ~/.bash_profile
加入下面的两行:
#.bash_profile
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
存盘, 退出Terminal, 重起Terminal.
update:
#~/.gitconfig
[user]
name = Phoenix
email = [email protected]
[alias]
co = checkout
ci = commit -a
st = status
br = branch
oneline = log --pretty=oneline --since='2 days ago'
onelog = log -p -1
[color]
diff = auto
status = auto
branch = auto
ui = auto
[core]
editor = vim
#.vimrc
syntax on
还是很方便,都是经常用的命令,推荐
放到 ~/.aliases
还要在~/.bashrc或者其它类似能加载到的地方
加上
source ~/.aliases
# ~/.aliases
# Record how much I've used various Git commands:
# http://github.com/icefox/git-achievements
alias git="git-achievements"
# Working with Git
alias g='git'
alias gs='git status'
alias gc='git commit'
alias gca='git commit -a'
alias ga='git add'
alias gco='git checkout'
alias gb='git branch'
alias gm='git merge'
alias gd="git diff"
# Working with Rails
alias s='script/server'
alias c='script/console'
alias m='rake db:migrate'
alias r='rake'
# Open the current directory in TextMate
alias e='mate .'
# Serve the contents of the current directory over HTTP
alias serve="ruby -rwebrick -e\"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start\""
Now source the aliases file from your ~/.profile to use them.
# ~/.profile
for I in aliases; do
[ -f ~/.$I ] && . ~/.$I
done
版本二
#Top ten commands
function t10 {
history |
awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' |
sort -rn |
head
}
# processes
alias tu="top -o cpu"
alias tm="top -o vsize"
# Git
alias gb="git branch"
alias gba="git branch -a"
alias gc="git commit -v"
alias gd="git diff | mate"
alias gl="git pull"
alias gp="git push"
alias gst="git status"
alias gco='git checkout'
# Ruby
# Quicker cd gems directory
alias cg='cd /usr/local/lib/ruby/gems/1.8/gems'
alias cg19='cd /usr/local/lib/ruby19/gems/1.9.1/gems'
# Rails
alias ss="script/server"
alias ss19="ruby19 script/server"
alias sc="script/console"
alias sc19="script/console --irb=irb19"
alias sg="script/generate"
alias sg19="ruby19 script/generate"
alias r="rake"
alias r19="rake19"
alias rmig="rake db:migrate"
alias rmig19="rake19 db:migrate"
alias rt="ruby -Itest"
alias rt19="ruby19 -Itest"
alias cs="RAILS_ENV=selenium cucumber -p selenium"
alias pgrep="ps -ef | grep $1"
source /usr/local/git/contrib/completion/git-completion.bash
PS1='\[\033]0;$MSYSTEM:\w\007\033[32m\]\u@\h\[\033[33m\w$(__git_ps1 " (%s)")\033[0m\]\n$'
Git 基础设置 (帐号和环境变量设置,颜色设置) 收藏
直接於 Shell 下執行下述:
git config --global user.name "Tsung"
git config --global user.email "[email protected]"
git config --global color.diff auto # git diff 要顯示顏色
git config --global color.status auto # git status 要顯示顏色
git config --global color.branch auto
註: 這些設定會在 ~user/ 下產生 .gitconfig
----------------------------------------------------------------
[color]
diff = auto
status = auto
branch = auto
[user]
name = Tsung
email = [email protected]
------------------------------------------------------------------
快 捷方式配置:
$ git config --global
alias.st status
$ git config --global
alias.ci commit
$ git config --global
alias.df diff
$ git config --global
alias.co checkout
$ git config --global
alias.br branch
临时性的设置的话就不要加--global 参数,比如
$ git config user.name "2"
$ git config user.email "[email protected]"
2011习惯版本
alias ll='ls -all'
alias g='git'
alias gst='git status'
alias gs='git push'
alias gc='git commit'
alias gca='git commit -a'
alias ga='git add'
alias gco='git checkout'
alias gb='git branch'
alias gl='git log'
alias gm='git merge'
alias gd="git diff"
alias gr='git remote'
alias be='bundle exec'
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM