对于备份 git 工作区/克隆,你们都有什么建议?
我需要一个包含未提交修改的备份,因为我的开发人员不喜欢经常提交。
I need a backup that included uncommitted modifications because my developers don't like to commit often.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需经常将克隆(包括工作目录)
rsync
到另一个位置即可。Just
rsync
the clone ( including working directory) to another location frequently.您可以使用 Dropbox 来实现此目的:只需在 Dropbox 内部工作即可。
警告:离线时不备份。
You can use Dropbox for this: just work from inside your dropbox.
Caveat: Does not backup when offline.
我认为ebneter的回答有一定的可取之处。
使用 git 最困难的部分是改掉所有其他 SCM 的坏习惯。听起来您的开发人员需要一些适当的工作流程培训。这还需要您花一些时间来理解他们为什么拒绝签入代码。
例如,他们可能只是反对提交损坏的代码。使用 git,只要他们不将代码推送到共享分支公共存储库,这就不是问题。然后,您还需要培训他们如何在准备发布本地提交时使用变基将本地提交压缩在一起。
其次,由于本地提交没有备份,因此仍然存在数据丢失问题。 (当然,这假设他们的其余文件没有备份,但超出了这个问题的范围。)
一种解决方案是让您的开发人员将他们的实验分支推送到公共存储库,然后如果发生任何情况,提交是安全的。请务必对公共存储库使用分支命名约定,这样就不会出现任何分支名称冲突。
I think ebneter's answer has some merit.
The hardest part about using git is unlearning bad habits from all the other SCMs. It sounds like your developers need some proper workflow training. This will also require you to take some time to understand why they are resisting checking the code in.
For example, it may be the case that they just are against committing broken code. With git, this is not a problem as long as they don't push the code to a shared branch public repository. You also then need to train them on how to use rebase to squash the local commits together when they're ready to publish it.
Secondly, since the local commits are not backed-up, you still have a data loss problem. (Of course, this assumes the remainder of their files are not backed up, but out of the scope of this question.)
One solution would be to let your developers push their experimental branches to the public repository, then if anything happens, the commits are safe. Be sure to use a branch naming convention for the public repo, so there will not be any branch name conflicts.