To solve this problem, you should be the only developper on your repository (or share it only with persons you trusts).
If someone else wants to contribute, he will clone your repository, make modifications on his own repository and do a "pull request".
You can verify this pull request and accept it or refuse it. So you have a full control of what is commited on your repository.
If only normal commits/push are done, you can always find your code looking the project history.
The only way to lose definitively informations on the repository is to force a conflicting push, erasing previous commits.
On GitHub, if you tag a version of your project, GitHub will create a zip archive of your project. This archive can never be erased (even if you force a tag modification: GitHub will ignore it).
So, you can protect your code by creating frequent tags. Even if you commit tree becomes erased, the tag archive will contain a save snapshot of your project.
发布评论
评论(1)
要解决此问题,您应该是存储库中的唯一开发人员(或仅与您信任的人共享它)。
如果其他人想要贡献,他将克隆您的存储库,对他自己的存储库进行修改并执行“拉取请求”。
您可以验证此拉取请求并接受或拒绝它。因此,您可以完全控制存储库中提交的内容。
如果只完成正常的提交/推送,您始终可以通过查看项目历史记录找到您的代码。
彻底丢失存储库信息的唯一方法是强制冲突的推送,删除以前的提交。
在 GitHub 上,如果您标记项目的版本,GitHub 将为您的项目创建 zip 存档。该存档永远无法删除(即使您强制修改标签:GitHub 也会忽略它)。
因此,您可以通过创建频繁的标签来保护您的代码。即使您的提交树被删除,标签存档也将包含项目的保存快照。
To solve this problem, you should be the only developper on your repository (or share it only with persons you trusts).
If someone else wants to contribute, he will clone your repository, make modifications on his own repository and do a "pull request".
You can verify this pull request and accept it or refuse it. So you have a full control of what is commited on your repository.
If only normal commits/push are done, you can always find your code looking the project history.
The only way to lose definitively informations on the repository is to force a conflicting push, erasing previous commits.
On GitHub, if you tag a version of your project, GitHub will create a zip archive of your project. This archive can never be erased (even if you force a tag modification: GitHub will ignore it).
So, you can protect your code by creating frequent tags. Even if you commit tree becomes erased, the tag archive will contain a save snapshot of your project.