global 代表全局设置
local repository objects文件夹中存储
stage area(缓冲区)通过index文件存储,由于是二进制存储所以显示出来是乱码
work area (工作区).git文件夹内
三个区域分别在哪
git init初始化将所在文件夹初始化为git仓库
git add 添加文件
git commit xx –m “xx” 提交xx文件 –m为写注释
git clone git://github.com/git/hello-world.git 从远程服务器克隆仓库到本地
建立仓库的两种方式: 1. 本地 git init
2. 远程 git clone xxxxxxx
查看远程仓库名 cd hello-wold 后git remote
建立文件 echo “hello-world” >>helloword.sundy
git diff –staged : 比较workspace VS staged
git diff –cached; statged VS local repository
git reset三种模式
git rm xx 删除文件,删除完后需要执行git commit –a –m “commit”才算真正的删除
git fetch origin
查看远程仓库 git remote 默认名字origin
建立分支
git branch xxx xxx分支的名字
切换到分支
git checkout xxx xxx分支的名称
合并分支
Git merge “merge branch1 to master” HEAD branch1
另一种做法
git checkout master git pull .branch1 (先转换到master在将分支拉过来 )
标记版本号:
git tag –a Beta1 –m “make beta1” 所有文件都设置为beta1版本
原文:http://www.cnblogs.com/vicma/p/3546315.html