
git
AndreaH
每天进步一点点!
展开
-
git更换主分支master
1、备份原master代码1、git checkout master2、git pull3、git checkout -b master-copy2、设置github或gitlab默认分支和受保护分支属性以gitlab为例:点开项目仓储,找到settings--repository 找到Default Branch,设置默认分支为其他分支 Protected Branches,如果master分支为受保护分支,点击下方的unprotected 如图3、切换.原创 2021-05-18 10:49:41 · 6576 阅读 · 0 评论 -
submodule 指定对应分支
1、创建子模块时指定一个分支通过-b指定对应分支git submodule add -b master [URL to Git repo];2、在.gitmodules文件中设置分支其中 DbConnector 是主目录中安装的子目录的名称, stable 是对应要设置的分支名称git config -f .gitmodules submodule.DbConnector.branch stable3、主目录中找到对应的子模块,切换到对...原创 2020-09-10 16:39:23 · 33542 阅读 · 0 评论 -
git新增、修改、删除本地和远程分支
新增分支git checkout -b newBranchName把本地分支push到远程仓库git push origin newBranchName:remoteBranchName删除分支git push origin :branchName (注意空格)修改本地分支名称1、git branch -m oldBranchName newBranchName (修...原创 2019-09-03 14:52:43 · 1011 阅读 · 0 评论