精华内容
下载资源
问答
  • git更改分支名称

    千次阅读 2019-09-09 11:41:00
    git 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...
    git 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 branch to track the new remote

     

    展开全文
  • # Rename branch locally...git branch -m old_branch new_branch # Delete the old branch git push origin :old_branch # Push the new branch, set local branch to track the new remote git push --set-up...

    方法:
    git branch -m old_branch new_branch

    git push origin new_branch

     

     

    展开全文
  • http://www.yiibai.com/git/git_managing_branches.html ...那么可通过使用-m选项后跟旧的分支名称和新的分支名称更改/重新命名分支名称。 $ git branch * master new_branch Administrat...

     

    http://www.yiibai.com/git/git_managing_branches.html

    重命名分支

    假设需要在项目中添加对宽字符的支持。并且已经创建了一个新的分支,但分支名称需要重新命名。那么可通过使用-m选项后跟旧的分支名称和新的分支名称来更改/重新命名分支名称。

    $ git branch
    * master
      new_branch
    
    Administrator@MY-PC /D/worksp/sample (master)
    $ git branch -m new_branch wchar_support

    现在,使用git branch命令显示新的分支名称。

    $ git branch
    * master
      wchar_support






     

    git branch用法总结

    标签: branchgit

    git branch
       
       git branch 不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,例如:
       #git branch
    * master
       newbranch

       git branch -r 列出远程分支,例如:
       #git branch -r
       m/master -> origin_apps/m1_2.3.4
       origin_apps/hardware/test
       origin_apps/m1
       origin_apps/m1_2.3.4
       origin_apps/master

       git branch -a 列出本地分支和远程分支,例如:
       #git branch -a
       * master
       newbranch
       remotes/m/master -> origin_apps/m1_2.3.4
       remotes/origin_apps/hardware/test
       remotes/origin_apps/m1
       remotes/origin_apps/m1_2.3.4
       remotes/origin_apps/master

       git branch 创建一个新的本地分支,需要注意,此处只是创建分支,不进行分支切换,例如:
       #git branch newbranch2
       #git branch
       * master
       newbranch
       newbranch2
       当前的分支依然是master,不进行切换。

       git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。

       git branch -d | -D branchname 删除branchname分支

       git branch -d -r branchname 删除远程branchname分支


    例子:
    git help branch中的一个例子:
       $ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
       $ cd my2.6
       $ git branch my2.6.14 v2.6.14   
       $ git checkout my2.6.14      
       第三行符合git branch <branchname> [<start-point>]的格式,即以v2.6.14为start-point,创建新的本地分支branchname。






    SYNOPSIS

    git branch [--color[=<when>] | --no-color] [-r | -a]
            [--list] [-v [--abbrev=<length> | --no-abbrev]]
            [--column[=<options>] | --no-column]
            [(--merged | --no-merged | --contains) [<commit>]] [<pattern>…]
    git branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
    git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
    git branch --unset-upstream [<branchname>]
    git branch (-m | -M) [<oldbranch>] <newbranch>
    git branch (-d | -D) [-r] <branchname>…
    git branch --edit-description [<branchname>]
     

    DESCRIPTION

    If --list is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option -r causes the remote-tracking branches to be listed, and option -a shows both local and remote branches. If a <pattern> is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if it matches any of the patterns. Note that when providing a <pattern>, you must use --list; otherwise the command is interpreted as branch creation.

    With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named commit will be listed. If the <commit> argument is missing it defaults to HEAD (i.e. the tip of the current branch).

    The command’s second form creates a new branch head named <branchname> which points to the current HEAD, or <start-point> if given.

    Note that this will create the new branch, but it will not switch the working tree to it; use "git checkout <newbranch>" to switch to the new branch.

    When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch. This behavior may be changed via the global branch.autosetupmerge configuration flag. That setting can be overridden by using the --track and --no-track options, and changed later using git branch --set-upstream-to.

    With a -m or -M option, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match <newbranch>, and a reflog entry is created to remember the branch renaming. If <newbranch> exists, -M must be used to force the rename to happen.

    With a -d or -D option, <branchname> will be deleted. You may specify more than one branch for deletion. If the branch currently has a reflog then the reflog will also be deleted.

    Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again. See also the prune subcommand of git-remote(1) for a way to clean up all obsolete remote-tracking branches.

    OPTIONS

    -d
    --delete

    Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream.

    -D

    Delete a branch irrespective of its merged status.

    -l
    --create-reflog

    Create the branch’s reflog. This activates recording of all changes made to the branch ref, enabling use of date based sha1 expressions such as "<branchname>@{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the core.logallrefupdates config option.

    -f
    --force

    Reset <branchname> to <startpoint> if <branchname> exists already. Without -f git branch refuses to change an existing branch.

    -m
    --move

    Move/rename a branch and the corresponding reflog.

     

    转载于:https://www.cnblogs.com/ydxblog/p/7987694.html

    展开全文
  • git-更改本地和远程分支名称 git 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 ...

    git-更改本地和远程分支的名称

    git 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 branch to track the new remote
    
    展开全文
  • 如何从master更改git default分支

    千次阅读 2020-09-17 01:41:32
    Recently, there are many suggestions about renaming the default branch master to some other name.... 最近,有许多关于将默认分支主机重命名为其他名称的建议。 这主要是由于主从比喻。 There is ev...
  • 括号扩展以在项目名称旁边显示 git 分支 发行说明: 1.0.7 - 解决了“手动”创建的文件未被文件观察者拾取的括号问题。 1.0.6 - 切换到新的 FileSystem API ... 当您返回 Brackets / EC 时,分支名称将反映更改
  • 今天踩了一个坑,顺便把之前的也总结一下,主要是平时用到的。 GitHub从今年十月份开始默认分支改成main了,我第一个项目是在Windows下建立的,用的GUI,所以没有注意。...git commit是提交更改 ...
  • 1、执行命令git checkout br_rename_old...3、执行命令git branch -m br_rename_old br_rename_new将本地仓库的br_rename_old的名称修改为br_rename_new 4、执行命令git push origin --delete br_rename_old将远程分支b
  • git 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 branch to ....
  • Git分支详解

    2019-06-02 12:51:21
    Git分支详解 git branch命令 查看分支 git branch 新建分支 git branch branch_name 切换分支 git checkout branch ...更改分支名称 git branch -m old_name new_name 创建分支并切换到新创建的分支 gi...
  • 查看项目的分支们(包括本地和远程) // 全部分支 $ git branch -a // 本地分支 $ git branch 删除本地分支 $ git branch -d <BranchName> 删除远程分支 $ git push origin --delete <BranchName> ...
  • Git global setup(全局设置) git config --global user.name "wangyf" git config --global user.email "wangyf@XXX.com" Create a new repository(创建一个新仓库) git clone ...
  • git 重命名本地分支

    2020-03-16 23:17:21
    git 重命名本地分支 文章目录git 重命名本地分支引言记得原分支名的情况不记得分支名的情况 引言 在工作中经常会碰到需要重命名本地分支的情况 ...如果不记得自己本地分支名称也不要紧 先用 git branch 查...
  • idea如何更改远程分支名称

    千次阅读 2019-10-30 14:06:31
    背景:当你突然觉得你开发的分支名称不顺眼时,怎么办? 1.修改本地名称 2.删除远程分支 3.推送本地分支到远程Git
  • git checkout 分支名称切换分支(切换回主分支前提交到仓库,不然develop分支文件会出现在master文件里面) git merge 来源分支合并分支 git branch -d 分支名称删除分支 (分支合并后才允许删除)(-D强制...
  •  更改当前分支名称git branch -m 名称  查看该项目的所有本地和远程分支:git branch -a ,并在当前所在分支前加"*"标记  拓展:git branch 查看本地分支  git branch -r 查看远程分支  切换...
  • 自动将您的分支名称放入git commit消息中。 如果要在每个提交消息中添加分支名称,那么此工具正是您所需要的。 你为什么需要这个? 通常,当我们使用git时,我们将分支的名称与任务/工单管理器(Jira,Trello等)...
  • 3.把当前分支与远程分支进行关联(branchname要改成你的当前分支名称) git push --set-upstream origin branchname 4.获取所有分支 git fetch 5.为分支或主干创建跟踪信息 git branch --set-upstream-to
  • git-stash - 将在脏的工作目录中的更改暂存起来 概要SYNOPSIS git stash list [<options>] git stash show [<options>] [<stash>] git stash drop [-q|--quiet] [<stash>] git stash ( ...
  • 1.git 删除远程地址 git remote rm origin 2.git 更换远程地址 git remote add origin ...3.把当前分支与远程分支进行关联(branchname要改成你的当前分支名称) git push --set-upstream origin branchnam...
  • 蜂巢流 Beehive Flow是一个git分支过程和一个支持CLI工具。 它是针对打包的软件和库而设计的,尤其...beehive-flow使用以下分支名称,每个分支名称都是流程的一部分: 主要的 释放/ xy 功能/ FEATURE_CODE 修补程序/

空空如也

空空如也

1 2 3 4 5 ... 15
收藏数 297
精华内容 118
关键字:

git更改分支名称