简体   繁体   English

如何创建没有提交历史的分支,该分支链接回分支的来源?

[英]How do I create a branch without commit history, that links back to where it branched from?

I'm using this guide: http://nvie.com/posts/a-successful-git-branching-model/ , as my way to use git with releases. 我正在使用本指南: http : //nvie.com/posts/a-successful-git-branching-model/ ,作为我在发行版中使用git的方式。 It advises you to use a develop and a master branch, and for each commit to master to be a production ready release. 它建议您使用developmaster分支,并且每次提交master都可以作为生产就绪版本。

I've finished version 0.1.0 of my project on my develop branch, and tried branching off of that commit with: 我已经在我的develop分支上完成了项目的0.1.0版本,并尝试使用以下命令从该提交分支出来:

git checkout --orphan master

whilst on the develop branch. 而在develop分支。 This worked, and created a new master branch, without prior commit history. 这可以正常工作,并创建了一个新的master分支,没有以前的提交历史记录。 But , the problem is that this new commit on master isn't linked to the develop commit it branched from, as visible in my repo's network pane on github. 但是 ,问题在于, master上的这个新提交未链接到其分支的develop提交,这在github上我的仓库的网络窗格中可见。 But both branches do seem to be linked in the guide I linked to above. 但是两个分支似乎确实都在我上面链接的指南中链接了。

Is it possible to branch from a commit, and keep the connection between branches but not the commit history? 是否可以从提交分支,并保持分支之间的连接但不保留提交历史记录? So that I have a single commit to master , that still links to where it branched from? 这样我就可以对master进行一次提交,但仍可以链接到它从何处分支? Or is that impossible? 还是那不可能?

That's not possible. 那不可能 It doesn't really make sense for a branch to show the point it branched from without showing any history. 分支在显示任何历史记录的情况下显示其分支点并没有任何意义。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何打印分支从主分支分支出来的子树? - How do I print the subtree where branch branched off master? 如何更改我分支的git分支? - How do I change the git branch from which I branched? 我如何查看不同分支中文件的提交历史而不检查该分支? - How do I view of commit history of file in different branch without checking out that branch? 如何在不添加分支的完整提交历史记录的情况下合并另一个仓库中的分支? - How can I merge a branch from another repo without adding the branch's full commit history? 修改git分支以从上游提交分支 - Modify git branch to be branched from upstream commit Git 从没有分支提交历史的特性分支创建新分支 - Git create new branch from feature branch without the branch commit history 如何从本地和远程的每个分支的Git Commit历史记录中删除文件? - How do I delete a file from the Git Commit history from every branch locally and remotely? 如何在合并分支之前将提交移回历史记录中的某个位置,同时保持分支完好无损? - How can I move a commit back to a location in history before a branch was merged while leaving the branch intact? 如何在保留提交历史记录的同时将代码块从一个git分支复制到另一个分支? - How do I copy a block of code from one git branch to another, while retaining commit history? 如何使git commit历史记录恢复正常? - How do I get my git commit history back to normal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM