Git创建分支HEAD的地方 [英] Git create branch where detached HEAD is

查看:382
本文介绍了Git创建分支HEAD的地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类型的指令

Instructions of the type

git branch temp

创建一个新的分支,但不要移动头部。

Create a new branch but don't move the head.

# Not currently on any branch.

我不想合并任何东西,我只想要一个新分支

I don't want to merge anything, I just want a new branch

推荐答案

你坐在一个独立的 HEAD

git checkout <sha>

您想在该提交中创建一个分支:

You want to make a branch at that commit:

git branch my-new-branch

现在切换到该分支:

And now switch to that branch:

git checkout my-new-branch

这篇关于Git创建分支HEAD的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆