-
2021-09-19 12:06:49
第一步:先修改本地分支重命名
git branch -m old new
示例:将dev分支修改为1.0.0
#git branch -m dev 1.0.0
第二步:删除远程分支
git push origin :远程分支名(你要删除的远程分支名,冒号前是空的,相当于用空的内容去抹掉远程分支)
示例:
#git push origin :dev
第三步:将本地分支推送到远程分支上,如果远程分支不存在,则创建此远程分支
git push origin 本地分支名:远程分支名
示例:#git push origin 1.0.0:1.0.0
更多相关内容 -
git修改分支名称
2021-12-14 12:04:37git修改分支名称 假设分支名称为oldName 想要修改为 newName 1. 本地分支重命名(还没有推送到远程) git branch -m oldName newName 2. 远程分支重命名 (已经推送远程-假设本地分支和远程对应分支名称相同) a. ...git修改分支名称
假设分支名称为oldName
想要修改为 newName1. 本地分支重命名(还没有推送到远程)
git branch -m oldName newName
2. 远程分支重命名 (已经推送远程-假设本地分支和远程对应分支名称相同)
a. 重命名远程分支对应的本地分支git branch -m oldName newName
b. 删除远程分支
git push --delete origin oldName
c. 上传新命名的本地分支
git push origin newName
d.把修改后的本地分支与远程分支关联
git branch --set-upstream-to origin/newName
注意:如果本地分支已经关联了远程分支,需要先解除原先的关联关系:
git branch --unset-upstream
-
Git修改分支名称
2021-09-01 17:46:311.修改本地分支名称 git branch -m beforeBranchName afterBranchName 2.删除远程分支 git push origin :beforeBranchName 3.将改名后的本地分支推送到远程,并将本地分支与之关联 git push --set-upstream ...1.修改本地分支名称
git branch -m beforeBranchName afterBranchName
2.删除远程分支
git push origin :beforeBranchName
3.将改名后的本地分支推送到远程,并将本地分支与之关联
git push --set-upstream origin afterBranchName
Demo:
D:\Codes2021\code>git branch -m feat_old feat_new D:\Codes2021\code>git push origin :feat_old warning: ----------------- SECURITY WARNING ---------------- warning: | TLS certificate verification has been disabled! | warning: --------------------------------------------------- warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information. warning: ----------------- SECURITY WARNING ---------------- warning: | TLS certificate verification has been disabled! | warning: --------------------------------------------------- warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information. remote: fatal: bad object 0000000000000000000000000000000000000000 remote: successfully To http://gitee.com/product/code.git - [deleted] feat_old D:\Codes2021\code>git push --set-upstream origin feat_new warning: ----------------- SECURITY WARNING ---------------- warning: | TLS certificate verification has been disabled! | warning: --------------------------------------------------- warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information. warning: ----------------- SECURITY WARNING ---------------- warning: | TLS certificate verification has been disabled! | warning: --------------------------------------------------- warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information. Enumerating objects: 129, done. Counting objects: 100% (122/122), done. Delta compression using up to 8 threads Compressing objects: 100% (66/66), done. Writing objects: 100% (91/91), 12.55 KiB | 494.00 KiB/s, done. Total 91 (delta 45), reused 0 (delta 0), pack-reused 0 remote: +++++++++++++++++++++++++++++++++++++++++++++++ remote: oldsha: 0000000000000000000000000000000000000000 remote: newsha: 87441c90b50dfcd94e3fbdc5e029cf94b013e7a3 remote: refname: refs/heads/feat_new remote: +++++++++++++++++++++++++++++++++++++++++++++++ remote: skip remote: remote: To create a merge request for feat_new, visit: remote: http://gitee.com/product/code/merge_requests/new?merge_request%5Bsource_branch%5D=feat_new remote: To http://gitee.com/product/code.git * [new branch] feat_new -> feat_new Branch 'feat_new' set up to track remote branch 'feat_new' from 'origin'. D:\Codes2021\code>
-
git 修改分支名称
2020-09-24 12:32:52场景:将分支名称为 oldbranch 改为newbranch 步骤: 1、将本地分支oldbranch切一个分支到本地 git branch -m oldbranch newbranch 2、删除远程分支 git push --delete origin oldbranch 3、将...场景:将分支名称为 oldbranch 改为 newbranch
步骤:
1、将本地分支oldbranch切一个分支到本地
git branch -m oldbranch newbranch
2、删除远程分支
git push --delete origin oldbranch
3、将本地新分支推送到远程
git push origin newbranch
-
gitlab 页面修改分支名称 最简单方式 dev变master
2021-08-11 16:08:42问题背景: 项目经理给了我一个项目地址,给了我维护者的权限,让我去提交分支,我只知道master分支是受保护的,所以就直接创建的dev分支(我以为是根据maste名字来判断被保护的分支,原来是第一个创建的就是默认的... -
记录一次git修改分支名称的坑
2018-10-25 00:16:27记录一次git修改分支名称的坑 使用的命令是 git checkout -b new_branch git push origin new_branch:new_branch 但是提交后并且使用编译工具部署后代码表现总是不对,死活找不到问题。 后来看到git上明白原来一直... -
gitlab修改远程分支名称
2021-06-04 10:18:52远程分支重命名 (已经推送远程-假设本地分支和远程对应分支名称相同) 重命名远程分支对应的本地分支 git branch -m oldName newName 删除远程分支 git push --delete origin oldName 上传新命名的本地分支 ... -
Git 修改分支的名称
2020-04-30 11:01:43需要将分支br_rename_old修改为br_rename_new,执行如下步骤: 1、执行命令git checkout br_rename_old切换到br_rename_old分支,如果已经在这个分支下,可以不执行此步骤 2、执行命令git pull origin br_rename_old... -
git修改远程分支名称
2019-06-27 14:25:02修改远程分支名称步骤: 删除远程分支 修改本地分支名称 提交修改后的本地分支 在项目目录下右键 Git Bash Here 依次执行如下命令: $ git push --delete origin 远程分支名称 $ git branch -m testLocalBranch ... -
Git 删除分支以及 修改分支名称
2019-01-16 09:32:16git checkout feature-optimize # 注:上述操作是删除个人本地和个人远程分支,如果只删除个人本地,请忽略第4步 修改分支名 git branch -m old_branch new_branch ### Rename branch locally git push origin :... -
Git修改分支名称并推送到远程
2021-08-19 01:57:09原博文链接:Git修改分支名称 方法一: 1、修改本地分支名称 git branch -m oldBranchName newBranchName 2、将本地分支的远程分支删除 git push origin :oldBranchName 3、将改名后的本地分支推送到远程,并将本地... -
git修改分支名称 -------- mark
2019-03-23 18:04:53git修改分支名称 我小时候可猛了_关注 0.52017.06.26 13:54*字数 111阅读 17688评论 1喜欢 20 假设分支名称为oldName 想要修改为 newName 1. 本地分支重命名(还没有推送到远程) git branch -m oldName newName... -
git 如何修改本地分支名称与远程分支名称
2019-04-08 11:20:11在工作中经常会遇到需要修改分支名的问题,假设现在的分支名为 20190408_old_branch,然后发现自己的分支名好像写错了,这时候应该如何修改本地分支名称与远程分支名称呢?只需要下面三行代码 1、-m 重命名分支,... -
git 修改本地和远程分支名称
2018-09-06 09:33:24git branch -a #查看所有分支 git branch -r #查看远程分支 git branch -vv #查看本地分支所关联的远程分支 ...git branch -m old_branch new_branch ...# Push the new branch, set...注意:把origin改为自己的名称 -
git如何修改远程分支名称
2020-05-26 11:53:55git如何修改远程分支名称1 背景2 解决方法 1 背景 为了修bug,重新checkout -b了一个分支进行处理。处理后push origin,并发起PR。一切完毕后,发现自己checkout -b的分支名有问题。 2 解决方法 前提: 远程错误的... -
git修改分支名称(本地或远程)
2019-06-13 15:40:27oldName等待修改的分支名字 newName将要修改的新名字 两种情况 情况一:未提交过的本地分支 git branch -m oldName newName 情况二:修改远程分支的名字 修改本地分支名字 git branch -m oldName newName 删除... -
git使用命令行修改远程分支名称
2020-04-27 14:46:051.修改分支名称 git branch -m <old branchName> <new branchName> 2.删除原本的分支 git push origin :<old branchName> 3.本地分支与线上分支建立连接 git push --set-upstream origin <... -
修改git远程仓库分支名称
2020-09-24 10:13:30# 重命名本地分支 git branch -m 旧分支名 新分支名 # 删除远程旧分支 git push --delete origin 旧分支名 # 将新分支推送至远程 git push origin 新分支名 # 将新本地分支和远程相连 git branch --set-upsteam-... -
git 修改本地分支名称和远程分支名称
2018-06-11 18:33:00修改本地分支名称 $ git branch -m branch-A branch-B 删除远程分支 $ git push origin :branch-A 将本地分支与远程新分支关联起来 $ git push --set-upstream origin branch-B 转... -
如何修改git分支名名称
2019-04-04 09:55:001. 修改本地git分支名称指令 git branch -m oldBranchName newBranchName 2. 修改远程仓库(github)上的分支名称 git本地分支名已修改,只需推送到远程仓库上,即可更换掉远程仓库的分支名称 转载于:... -
git 刷新分支、修改本地和远程分支名称
2020-04-03 17:29:52#刷新分支 git remote update origin --prune #查看所有分支 git branch -a #查看远程分支 ...# 修改本地分支名称 git branch -m old_branch new_branch # 删除远程旧分支 git push ori... -
idea如何更改远程分支名称
2019-10-30 14:06:31背景:当你突然觉得你开发的分支名称不顺眼时,怎么办? 1.修改本地名称 2.删除远程分支 3.推送本地分支到远程Git -
eclips git命令 修改分支名字
2018-10-24 13:54:071、切换到要修改名称的分支; 2、右击项目——Team——Advanced——Rename Branch…; 3、在弹出的Branch Rename框中选中要修改名的分支——Rename; 4、在弹出的New Branch Name框中输入新的名称... -
git更改分支名称
2019-09-09 11:41:00git branch -m old_branch new_branch // Rename branch locally git push origin :old_branch // Delete the old branch git push --set-upstream origin new_branch // Push the new branch, set local...