git 常用命令

84 阅读1分钟

git合并全部

git checkout master  ===> 切换分支

git merge pre            ===>把pre分支合并到master

git pull                       ===>拉取代码

git push                      ===>推送代码

git checkout pre         ===>切换回分支

git合并单个文件

git checkout master            ===>切换分支

git checkout pre  (文件名) ===>另一个分支的文件覆盖到当前的分支上

git commit -m "备注"         ===>提交代码

git push                              ===>推送代码

git克隆代码

git clone "项目地址"

git克隆指定分支代码

git clone -b 分支名称   项目地址

git拉取代码

git pull

git查看文件状态

git status

git添加代码

git add xxx(文件名)

git add .  添加全部

git提交代码

git commit -m "提交备注"

git推送代码

git push

git查看分支

git branch 

git查看提交记录

git log

git回退版本

git reset --hard xxx(commit版本号,需要前几位就行,git会去查找)