没有任何提交更改分支

时间:2013-06-24 13:15:42

标签: git

我可以在“master”分支中没有任何“提交”的情况下作为“分支”工作。

我在这个分支。

branch master

我希望在分支“newStyle

中工作

问题

如果我从未在newStyle中提交过,那么切换到“master”分支是否可行(如果是,如何)?

1 个答案:

答案 0 :(得分:4)

是的,它被称为orphan branch

git checkout --orphan newStyle     # only in git1.7.2+
git rm -rf .                       # if you want to start from scratch
<do work>
git add your files
git commit -m 'Initial commit'

另请参阅this article中的示例。

相关问题