1、git下载代码
1、git下载远程仓库的代码
git clone 仓库地址
2、下载指定分支的代码
如果已经clone了
git checkout -b 本地分支名 origin/远程分支名
如果没有clone
git clone -b 分支名 仓库地址
2、git提交代码的流程
//同步代码 这一步在commit之前就可以了
git pull 分支名
//添加到暂存区
git add 文件名
//将暂存区的内容提交到本地仓库
git commit -m "提交的内容说明"
//将代码推到远程
git push 分支名
3、git常用操作
1、分支相关的操作
//查看分支
git branch
//新建分支
git branch 分支名
//删除分支
git branch -d 分支名
//强制删除分支
git branch -D 分支名
//还原未暂存文件
git checkout 文件名
//撤销已提交(commit)文件
git reset 文件名
2、版本、日志相关操作
//查看提交日志
git log
git log --pretty=oneline --abbrev-commit --all --graph
//查看修改
git show commitID
//追溯文件修改历史
git blame 文件名
//追溯文件修改历史 指定行数
git blame -L n1,n2 文件名
//回退版本
git reset --hard commitID
//合并分支
git merge
git的四个工作区