如何在不添加所有现有文件的情况下创建分支? [英] How to create a branch without adding all the existing files?

查看:85
本文介绍了如何在不添加所有现有文件的情况下创建分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何在不添加所有现有文件的情况下创建分支?

当我在git中创建分支时,所有创建的文件都会添加到新分支。 / p>

解决方案

  git checkout --orphan branchname 
git rm -rf。

完成后,您可以创建,添加和提交新文件,并且生成的分支将没有公共历史与您项目中的任何其他分支(除非您在某个时候合并它们)。


When I create branch in git, all the created files are added to the new branch.

How can I create a branch without adding all the existing files?

解决方案

git checkout --orphan branchname
git rm -rf .

After doing that you can create, add, and commit new files and the resulting branch will have no common history with any other branches in your project (unless you merge them at some point).

这篇关于如何在不添加所有现有文件的情况下创建分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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