简体   繁体   English

在分叉存储库和本地分支上进行git家务管理

[英]git housekeeping on forked repository and local branches

Just need some suggestion /advise on below scenario please In our company, we have github implemented and as part of our defect fix or enhancement in our development process. 在下面的场景中,只需要一些建议/建议即可。在我们公司中,我们已经实现了github,并且作为我们开发过程中缺陷修复或增强的一部分。

  1. We fork git repository to each developer id 我们将git存储库派生到每个开发人员ID
  2. Create new branch based on defect/enhancement id 根据缺陷/增强ID创建新分支
  3. Fix/implement in this local repo/branch and test it. 在此本地存储库/分支中修复/实现并对其进行测试。 Once tested 一旦测试
  4. We raise pull request 提出拉动要求
  5. Administrator reviews the pull request and merge the changes. 管理员查看拉取请求并合并更改。
  6. And so on. 等等。

But I noticed, we leave the forked repository and branch created (for fix/enhancement) I don't see we perform any housekeeping to delete these repo/branches. 但是我注意到,我们保留了创建的分叉存储库和分支(用于修复/增强),但我看不到我们会执行任何内务处理来删除这些存储库/分支。 Please advise the best practice and the workflow for housekeeping Also how to automate the analysis and get report? 请告知最佳做法和客房整理工作流程。另外,如何使分析自动化并获得报告? Thanks in advance 提前致谢

Here's a quick answer about cleaning up branches. 这是有关清理分支的快速解答。 Remember, the branch exists both locally and on the forked remote. 请记住,分支既存在于本地,也存在于分支的远程服务器上。

  • Delete the branch on the remote fork through GitHub.com (or your company's access site). 通过GitHub.com(或您公司的访问站点)删除远程分支上的分支。
  • Delete the branch locally: git branch -d <branch-name> . 本地删除分支: git branch -d <branch-name>
  • Update the local repository and get rid of the remote tracking branch: git pull --prune . 更新本地存储库并摆脱远程跟踪分支: git pull --prune

However, there's a bigger question about workflow. 但是,关于工作流还有一个更大的问题。 Do you delete the fork every time you merge a branch, then re-fork when you start a new branch? 每次合并分支时都删除分叉,然后在开始新分支时重新分叉吗? Could your team instead let you branch on the same repository and give you collaborator access? 相反,您的团队可以让您在同一个存储库上分支并为您的协作者提供访问权限吗?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM