出于管理目的删除主题分支、存档
我正在使用 git-flow 和许多主题分支,又称功能分支。当我决定采取完全不同的路线时,我正在开发一个功能分支。
我现在想删除该分支,因为那里的工作不会合并到开发或主控中,它只会“混乱”分支列表。
但出于历史和行政目的,我想将历史保留在该分支中(并且我们所有人都再次改变主意并且必须挖掘存档的工作的奇怪机会)。
最好的路线是什么?我可以简单地gitbranch-D
它并在稍后的时刻让它死亡吗?如果是这样,执行此操作的命令是什么?
I am using git-flow and many topic-branches, AKA feature branches. I was working on a feature branch, when it was decided to take an entirely different route.
I now want to remove that branch, as the work in there will not be merged into development or master and it only "clutters" the list of branches.
But I'd like to keep the history in that branch for historical and administrative purposes (and the odd chance that we all change our mind again and the archived work has to be dug out).
What would be the best route? Can I simply git branch -D
it and rise its death at a later moment? If so, what would be the command to do so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以有一个“墓地”存储库,与您的工作存储库分开,其中只包含存档的分支?然后,您可以简单地将其作为远程存储库连接,将存档分支推送到它并从本地删除它。它仍将作为
remotes/graveyard/feature
存在You could have a "graveyard" respoitory, separate from your working one, that just has archived branches in it? Then you can simply have it connected as a remote repository, push the archived branch to it and delete it from your local. It will still be there as
remotes/graveyard/feature
为此目的使用标签。它们不会弄乱您的分支机构列表。
Use tags for that purpose. They won't clutter your branch listing.
如果你删除了一个分支,就无法返回。您必须做出是否删除的决定。也许你可以这样做:
仍然污染你的分支输出,但你可以将其过滤掉。
If you delete a branch, there is no going back. You have to make a decision whether to delete or not. Probably you can do something like:
Still pollutes your branch output, but you can filter it out.
对于某种存档存储库也有同样的想法。
我的解决方案是启动第二个服务器存储库作为存档存储库,该存储库在分支存档上检出。
主服务器存储库是裸露的,以便在从客户端存储库推送和拉取时具有更好的可用性。
唯一仍然悬而未决的问题是主存储库和客户端也存储存档对象。我还没有找到解决方案,因为找不到正确的命令组合。
顺便问一下,是否有一个选项可以声明一些用于清理和备份的例行命令?
Had the same idea for somekind of archive repo.
My solution for it was to initiate a second server repo as archive repo, which is checked out as on the branch archive.
The main server repo is bare for a better usability when pushing and pulling from the client repos.
Only Issue that is still open is the one that the main repo and the clients are storing the archived objects too. I haven't found a solution for that, cause couldn't find the right combination of commands.
By the way is there a option for delaclaring some routine commands for clean-up and backups?