Repository 仓库、版本库
Workspace 工作区
index 索引
git init
git add index.htm
git add .
git status
tracked
untracked
ignored
git commit -m "1st commit"
提交更改到版本库
-m
git的提交分为两个步骤:
暂存变更:add作用是把新文件或文件新的改动添加到一个暂存区stage,也就是加入到index中
git commit index.htm
git commit --amend
git log
git diff
git diff --cached
git diff HEAD
查看被跟踪文件,比较工作区和上一次commit的差异,HEAD指代最后一次commit
git checkout
git checkout file
git checkout commit file
git checkout .
git reset
git reset file
git reset --hard
git reflog
git reset commit
git reset --hard [commit]
reset操作要慎重
git mv src dest
git rm file
git rm --cached file
以上三个命令执行commit后才真正改动
git config --global user.name "lptnyy"
git config --global user.email "lptnyy@magedu.com"
内容存储在 ~/.gitconfig
git remote add origin http://name@IP:Port/name/gittest.git\
git push -u origin master
ssh-keygen -t rsa -C "lptnyy@magedu.com"
git clone git@IP:name/gittest.git
git stash
git stash pop
从栈中取出刚才保存的变化
最佳实践
develop,开发分支,开发人员都是检出这个分支开发
原文:http://blog.51cto.com/11281400/2120719