Git学习总结2

$ cd $WORK
$ git pull //更新本地工作树

即可以将属于同一项目的远端仓库与同样属于同一项目的本地仓库进行合并,它包括两个操作:从远端仓库中取出更新版本,然后合并到本地仓库。

git命令总结:
git fetch path/to/his/newrepo hisbranch:yourbranch //将hisbranch抓取到你的分支上,如果yourbranch被省略,就默认为本地当前分支
git merge //合并他的工作
git pull的四种用法
1、git clone之后用git pull来同步
2、git pull . 来代替git merge命令
3、git pull /path/to/repo 将远程仓库内容直接merge到当前分支
4、git pull /path/to/repo <src>:<dst> 来指定源的分支和本地分支
git whatchanged -p branch1..branch2 //查看两个分支的区别,-p表示以易理解的自古方式表示两者区别
git checkout filename //将文件代码恢复到index中的状态。

更多操作命令参考: http://www.360doc.com/content/12/0222/11/1016783_188574226.shtml

猜你喜欢

转载自wang-2011-ying.iteye.com/blog/1533107
今日推荐