ubuntu git 使用

 1 apt-get install git//ubuntu安装git
 2 
 3 mkdir -p /var/www/gitProj //创建文件夹
 4 
 5 cd /var/www/gitProj //进入文件夹
 6 
 7 git init //初始化git
 8 
 9 git config --global user.name "e"//配置文件中的用户名
10 
11 git config --global email "zhangjun516@126.com"//配置文件的邮箱
12 
13 vi index.php //创建以及编辑文件
14 
15 git add index.php //将编辑好的文件添加到git,如果是新文件,不使用此命令的时候,在提交的时候,不会检查到此文件
16 
17 git commit -m 'test'//提交
18 
19 tig//可以查看你提交的或者他人提交的版本号
20 
21 apt-get install tig//安装
22 
23 git diff //在文件没有提交之前,你可以使用此命令查看修改之前和之后的区别
24 
25 git commit -a -m //文件进行编辑以后,可以使用此命令直接进行提交,-a;或者你使用git add ,在提交
26 
27 vi .gitignore //git commit -a -m这个命令会扫描文件夹下所有的文件进行提交,你可以创建这个文件,把不需要提交的文件的名称写入,就不会扫描到了
28 
29 git config --global alias.ci "commit -a -m" //设置简写的命令
30 
31 git  stash //当你还没有写完之前,想提交别的东西,那么你可以先收藏这次的修改,去修改别的东西进行提交,提交完了以后,使用下面的命令,继续你的修改
32 
33 git stash apply//继续修改
34 
35 git checkout [版本号] -b 备份名称  //备份,或者是备份分支
36 
37 
git checkout [name]
//切换分支
38 
39  http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/ch02.html //这个网址写的不错
40 
41  
42 
43  
44 
45  
46 
47  

 

posted @ 2013-10-10 09:35  尹少爷  阅读(819)  评论(0编辑  收藏  举报