首页 > 其他分享 >git 分支改名

git 分支改名

时间:2023-01-29 14:24:12浏览次数:64  
标签:重命名 origin git 改名 name master 分支

git 本地分支改名

// 当前分支
git branch -m new_name

// 非当前分支
git branch -m old_name new_name

git 远程分支改名

远程分支改名,其实是删除远程分支,或者强行更新已有分支。 然后推送新分支。

// 删除分支,但是有些时候会被服务器拒绝
git push --delete origin master

// 强行更新已有分支
git push --force origin master

// 推送新分支
git push origin new_name

参考:

Git 分支重命名 git rename branch
https://blog.csdn.net/qq_37148270/article/details/107106392

git 重命名分支_轻松将Git默认分支从master重命名为main
https://blog.csdn.net/cunfuxiao7305/article/details/109050545

重命名master分支
https://blog.csdn.net/gtlbtnq9mr3/article/details/106754375

标签:重命名,origin,git,改名,name,master,分支
From: https://www.cnblogs.com/ramlife/p/17072561.html

相关文章

  • error:03000086:digital
    运行老项目报错opensslErrorStack:[‘error:03000086:digitalenveloperoutines::initializationerror‘]vue.js前端npmnpmrunserve报错open......
  • 使用Git操作Gitee命令
    使用Git操作Gitee命令安装Git略上传代码到Gitee首先,在Gitee上新建仓库,设置为公开;然后,打开GitBash,执行如下命令:gitconfig--globaluser.name"kylewang_ai"gi......
  • Linux工具篇 | Linux diff与git补丁文件的生成与使用
    一、diff命令生成的补丁(1)补丁文件的生成在某一目录下新建目录patch-test-new与patch-test-old:~/Study/patch$lspatch-test-newpatch-test-old分别在目录patch-test-new......
  • git设置多个远程仓库
    1.添加多个远程仓库,单独push/pull在添加的原有origin远程仓库之后,添加mirror远程仓库gitremoteaddmirrorhttps://url2.com/my_repo.git对应.git/config[cor......
  • 15年封神,GitHub开发者破亿!
    15年封神,GitHub开发者破亿!投递人 itwriter2 发布于 2023-01-2717:25 评论(0) 有1028人阅读 原文链接 [收藏] « »封神15年,GitHub用户现如今破了1......
  • Git命令
    环境配置//配置用户信息gitconfig--globaluser.name"name"gitconfig--globaluser.email"email"//查看所有用户配置gitconfig--list//查看user.name配......
  • 使用git和gitlab进行协同开发流程
    一、基本概念1.仓库(Repository)①源仓库(线上版本库)在项目的开始,项目的发起者构建起一个项目的最原始的仓库,称为​​origin。​​源仓库的有两个作用:1.汇总参与该项目的各......
  • 查看git的用户名和密码
    转载自:https://www.cnblogs.com/xihailong/p/13354628.html一、查看查看用户名:gitconfiguser.name查看密码:gitconfiguser.password查看邮箱:gitconfiguser.email查......
  • netrw auto expand all node when using git difftool vimdiff compare two directoie
    匹配结点\v^(.([\.])@!)+\/$匹配节点,并展开:golobal/\v^(.([\.])@!)+\/$/exe"normal\<CR>"不过这里有个问题,展开过一次的节点,下次执行还会再展开一次,导致又关闭所......
  • 02pycharm 如何添加代码上传到gitlab
    1.首先正确安装好python,pycharm工具(这边不做介绍) 2.下载git的windows客户端官网:https://git-scm.com/download/win  根据自己的系统选择合适的版本,下载安装......