git

 

git rm 删除文件(不再纳入版本管理)

 

git rm --cached 使已经纳入版本管理的文件变成untracked状态 

git command -a 跳过git add 直接提交

git diff 查看unmodify与modify之间的不同

git diff --cached/--staged 查看staged与unmodify之间的不同

git mv README.txt README--> 相当于:mv README.txt README;git rm README.txt;git add README 

git checkout -- file 撤销修改(注意假设文件已经git add就不行了,也就是说文件已经做了修改,并且我还没有git add file)

git reset HEAD filename 撤销暂存:

(demo)

tinyos@tinyos:test$ vi hello3.c;vi hello3.c;git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   hello2.c
#       modified:   hello3.c

 

tinyos@tinyos:test$ git reset HEAD hello2.c hello3.c 

Unstaged changes after reset:
M       hello2.c
M       hello3.c

tinyos@tinyos:test$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   hello2.c
#       modified:   hello3.c
#

 看到没?Changes to be committed: -> changed but not uodated

 

git pull 其实它是git fetch 与 git merge 的两个操作 

 

 关于git clone http:// 错误:

tinyos@tinyos:~$ git clone http://127.0.0.1/git.git git3
Initialized empty Git repository in /home/tinyos/git3/.git/ 

fatal: http://127.0.0.1/git.git/info/refs not found: did you run git update-serv

 解决方法:

tinyos@tinyos:~$ cd /var/www/git.git

tinyos@tinyos:~$ git update-server-info 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted on 2012-03-26 21:24  vincent Van Gogh  阅读(272)  评论(0编辑  收藏  举报

导航