git是一款代码版本控制软件,目前已被普遍的使用。所以优雅的使用git已经成了开发者的必备技能。
区别于SVN,git的特色是去中心化。git
git log
git status
git add filename
git commit -m 'update info'
git pull
git push origin master
vi .gitignore//修改 .gitignore ,增长相关文件名或目录,支持通配符
*.a # 忽略全部 .a 结尾的文件 !lib.a # 但 lib.a 除外 /TODO # 仅仅忽略项目根目录下的 TODO 文件,不包括 subdir/TODO build/ # 忽略 build/ 目录下的全部文件 doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt
git rm -r --cached .
git checkout filepath/filename
git fetch
git checkout -b branchname
git merge origin/mastervim
你我的的用户名称和电子邮件地址,用户名可随意修改,git 用于记录是谁提交了更新,以及更新人的联系方式。缓存
git config --global user.name "Donly Chan" git config --global user.email donly@example.com
在解决冲突时常常用到,通常为vimdiff工具
git config --global merge.tool vimdiff
颇有用的颜色提示,因有些人不喜欢,因此默认是不开启的fetch
git config --global color.ui auto
git config --list
git config user.name
/etc/gitconfig 对全部用户有效 ~/.gitconfig 对当前用户有效 {工做目录}/.git/config 仅对当前项目有效