Git最基本操作

git配置用户邮箱和用户名:

git config --global user.email "xx@xx.com"

git config --global user.name "xx"

克隆远程代码:git clone ssh://git@xxxxxxxxxx

创建本地develop分支:git checkout -b develop

同步代码:git pull origin develop

获取本地全部修改:git status

比较差异:git diff

提交到本地仓库:git commit -a -m "xxx"

提交到远程仓库:git push origin develop

创建分支: git branch branch1

进入分支: git checkout branch1

创建并进入分支: git checkout -b branch1

将本地分支进行改名: git branch -m old_branch new_branch

将本地分支的远程分支删除: git push origin :old_branch

将改名后的分支push到远程,并让本地分支关联远程分支: git push --set-upstream origin new_branch

原文地址:https://www.cnblogs.com/avalon-merlin/p/9197681.html