git 高频命令大全

109 阅读1分钟

克隆仓库 : git clone 仓库地址

代码推到暂存区 : git add .

代码推到本地仓库 : git commit -m 描述

代码上传云端 : git push

查看日志: git log

查看简洁版日志: git reflog

版本回退 : git reset --hard head~2 版本回退 git reset --hard 1ff546383

查看分支: git branch

切换分支: git checkout 分支名

创建并切换分支: git checkout -b 分支名

合并分支: git merge 分支名

添加远程仓库地址:git remote add origin 仓库地址

修改远程仓库地址: git remote set-url origin 仓库地址

第一次提交代码: git push -u origin master

以后提交代码: git push origin master

查看远程仓库信息: git remote -v