如何在git上命名(无分支)-branch

时间:2022-07-03 23:44:14

It happened somehow that I left the master branch and ended up on the no branch branch. How can I give this branch a meaningful name?

它发生了某种程度,我离开了主分支,结束了无分支分支。我怎样才能给这个分支一个有意义的名字?

In detail: Calling git branch shows

详细信息:调用git branch显示

* (no branch)
  master

and what I want (without changing any file) is to have e.g.

我想要的(不改变任何文件)是

* extraBranchIEndedUpWith
  master

git status is clean.

git状态很干净。

1 个解决方案

#1


6  

"no branch" is not a branch, as the name says. It means you have checked out a revision that isn't the tip of a branch.

正如名字所说,“没有分支”不是分支。这意味着您已经签出了不是分支小费的修订版。

To create a branch of it, simply

简单地创建它的一个分支

git checkout -b extraBranchIEndedUpWith

Just like you would create any other branch from your current revision.

就像您从当前版本中创建任何其他分支一样。

#1


6  

"no branch" is not a branch, as the name says. It means you have checked out a revision that isn't the tip of a branch.

正如名字所说,“没有分支”不是分支。这意味着您已经签出了不是分支小费的修订版。

To create a branch of it, simply

简单地创建它的一个分支

git checkout -b extraBranchIEndedUpWith

Just like you would create any other branch from your current revision.

就像您从当前版本中创建任何其他分支一样。