为了方便自己查询,将最近用到的Git命令整理如下:
git init # 在本地建立一个仓库
git clone (repository) # git clone默认会把远程仓库整个给clone下来
git status
git add modified_file #可以用Regular Expression匹配多个文件
git branch [ -a] #查询分支
git checkout [abranch] # 切换分支
git diff modified_file
git diff --cached modified_file
git commit -m "#there are comments"
git log # 查看提交记录
git remote show origin # 查询远程的git地址
git fetch
git pull # pull = fetch+ merge
git merge some_branch # 把some_branch分支合并到当前分支,想见参考1
git push origin master
git push origin npm:npm # origin = URL of git 本地分支:远程分支