GIT(5)----常用命令:新分支,切换,删除,远程推送,标签,日志

常用命令

1.新分支

  创建新分支:git branch <branch_name>

  创建分支并切换到新的分支上:git checkout -b <branch_name> 

2.切换到新分支:git checkout <branch_name> 

3.回滚版本:git reset –hard commit-id 

4.删除本地分支:git branch -D <branch_name> 

5.删除远程分支:git push origin --delete <branch_name>

6.将新分支上传到远程仓库:git push -u origin develop 

7.查看提交的记录:git log

例子

1.本地创建分支 ----> 提交到远程仓库

git checkout <branch_name> 
git push -u origin <branch_name>

1.删除本地分支 ---->同时远程分支

git checkout <branch_name> 
git push origin --delete <branch_name>
原文地址:https://www.cnblogs.com/cv-pr/p/6932049.html