Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2446606
  • 博文数量: 328
  • 博客积分: 4302
  • 博客等级: 上校
  • 技术积分: 5486
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-01 11:14
个人简介

悲剧,绝对的悲剧,悲剧中的悲剧。

文章分类

全部博文(328)

文章存档

2017年(6)

2016年(18)

2015年(28)

2014年(73)

2013年(62)

2012年(58)

2011年(55)

2010年(28)

分类: 项目管理

2016-01-28 19:16:20

Git Setup

I would recommend editing your ~/.gitignore_global file and adding the following lines (to eliminate common system-created files while working in your Git repositories):

*~

.*.swp

.DS_Store

Add the following to your ~/.gitconfig file:

[user]

    name =

    email =

[color]

    ui = true

    status = auto

    branch = auto

    diff = auto

[alias]

    co = checkout

    ci = commit

    cp = cherry-pick

    st = status

    stat = status

    br = branch

    hist = log --pretty=format:\"%u %ad | %s%d [%an]\" --graph --date=short

    type = cat-file -t

    dump = cat-file -p

    ff = merge --ff-only

    rn = log --pretty=format:\"%ad - %s%d\" --date=short

    pa = add --patch

These add useful Git command shortcuts, like git st, git ci, and a very useful git hist, which provides Git commit history viewed like (lines shortened to fit in browser):


Also recommend is the Git . You can get the git-completion.bash script from . Once you've installed the completion script, you can make it work by editing your ~/.profile to add:

source ${PATH_TO_SCRIPT}/git-completion.bash

 

GIT_PROMPT='$(__git_ps1 " [%s]")'

 

CYAN="\[\033[1;36m\]"

YELLOW="\[\033[1;33m\]"

GREEN="\[\033[0;32m\]"

RESET="\[\033[1;0m\]"

PS1="$CYAN\h$RESET (\W$YELLOW$GIT_PROMPT$RESET)$GREEN\$$RESET "


This will also add a colored shell prompt, with the branch in yellow


阅读(1701) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~