1、克隆
git clone 仓储地址 克隆之后一般在master分支(主分支)
2、创建分支
git checkout -b test test为新分支名
3、查看分支
git branch [-a] -a 为参数,中括号不需要输入,可以查看所有分支
4、切换分支
git checkout test 切换到test分支
5、查看当前修改文件
git status
6、提交修改
git add . git commit -m "注释"
7、推送远程分支
git push origin test test 当前分支的远程分支
8、合并代码
目的:将别人的代码合并到自己的分支,如将master上面的修改,合并到自己的分支 git merge master 通常先到master分支更新代码,再合并到自己的分支 以test分支为例,先执行 git checkout master, 再执行更新命令拉取远程最新代码 git pull origin master, 切回test分支 git checkout test,再将master代码合并到test分支 git merge master