用Git防止文件覆盖 [英] Preventing a file overwrite with Git

查看:141
本文介绍了用Git防止文件覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司最近开始使用Git进行源代码版本控制,并且由于编码人员的无能 - 这就是我和我的老板:-P - 我们有一个很好的意大利文件被覆盖在这里和那里。

有没有办法将某些文件标记为不可触摸的,因此如果从另一个文件更新分支时要么不覆盖文件要么根本不执行更新? >
在此先感谢。

my company started recently to use Git for source version control, and due to the incompetence of the coders - that's me and my boss :-P - we have a really nice spaghetti of files being overwritten here and there.
Is there a way to mark certain files as 'untouchable' so if when updating a branch from another either do(es)n't overwrite the file(s) or doesn't do the update at all?
Thanks in advance.

推荐答案

你可以用钩子完全做你想要的,但我不会不知道这是否能解决您真正的问题。

You can do exactly what you're asking for with hooks, but I don't know if that solves your real problem.

如果您的进行中文件变得非常简单,那很简单:永远不要使用未提交的更改进行合并/重新绑定。在引入任何其他代码之前始终进行提交。

If it's as simple as your in-progress files getting munged, that's easy: Never pull/merge/rebase with uncommitted changes. Always commit before bringing in any other code.

这篇关于用Git防止文件覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆