git 分支常用命令

常用命令

# 克隆远程仓库https://gitee.com/codechen01/Test.git下的dev分支
git clone -b dev https://gitee.com/codechen01/Test.git


# 将本地master分支修改推送到远程dev分支(如果远程仓库没有dev分支会自动新建)
git push origin master:dev


git branch # 查看分支列表
git checkout -b newBranch # 新建newBranch 分支并切换到新分支
git checkout master # 切换到master分支
git branch -m newBranchName # 重命名当前分支为newBranchName
git merge newBranch # 把newBranch 分支合并到当前所在分支
git branch -d newBranch # 删除newBranch 分支

注意:命令后面的#是命令注释作用

vs2019中使用命令行执行git命令

“工具”-》“命令行”-》“开发者PowerShell”

 vs查看当前所在分支

使用命令 git branch 查看分支列表,有*标注的分支就是当前所在分支

 

参考链接

https://blog.csdn.net/u010059669/article/details/82670484

 

posted @ 2021-02-08 09:00  温故纳新  阅读(74)  评论(0编辑  收藏  举报