Git rebase和每个开发者的半跟踪配置文件 [英] Git rebase and semi-tracked per-developer config files

查看:96
本文介绍了Git rebase和每个开发者的半跟踪配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个SO问题,我对Git也很陌生.

This is my first SO question and I'm new-ish to Git as well.

背景: 在大约8个开发人员的团队中,我应该是Git的版本控制专家.因为我没有很多Git经验,所以这很令人兴奋. 我决定我们需要一个共享存储库,该存储库将是生产代码的权威母版和开发代码的主要集合点.在为公司工作时,确实确实需要至少显示生产代码的权威来源.

Background: I am supposed to be the version control guru for Git in my group of about 8 developers. As I don't have a lot of Git experience, this is exciting. I decided we need a shared repository that would be the authoritative master for the production code and the main meeting-point for the development code. As we work for a corporation, we really do need to show an authoritive source for the production code at least.

我已指示开发人员在从共享存储库中提取内容时进行重设基础,然后推送他们要共享的提交.我们一直在遇到特定类型文件的问题.

I have instructed the developers to pull-rebase when pulling from the shared repository, then push the commits that they want to share. We have been running into problems with a particular type of file.

我目前认为是典型问题的这些文件之一称为web.config.我们希望克隆一个受版本控制的主web.config,供开发人员使用,但是每个开发人员都可以对此文件进行较小的编辑,以使其希望在本地保存但不共享.

One of these files, which I currently assume is typical of the problem, is called web.config. We want a version-controlled master web.config for devs to clone, but each dev may make minor edits to this file that they wish to locally save but not share.

问题是这样的:我如何告诉git not 认为本地更改或对此文件的提交是重新定级和推送的相关内容? Gitignore似乎无法解决问题,但这也许是因为我将web.config放入.gitignore太晚了吗?

The problem is this: how do I tell git not to consider local changes or commits to this file to be relevent for rebasing and pushing? Gitignore does not seem to solve the problem, but maybe that's because I put web.config into .gitignore too late?

在一些简单的情况下,我们堆叠了本地更改,对它们进行了重新设置,推送和弹出,但这似乎并非始终有效.我还没有掌握模式.

In some simple situations we have stacked local changes, rebased, pushed, and popped the stack, but that doesn't seem to work all of the time. I haven't picked up the pattern quite yet.

关于pull --rebase的已发布文档倾向于处理更简单的情况.

The published documentation on pull --rebase tends to deal with simplier situations.

还是我完全有错误的主意?我们在滥用Git吗?

Or do I have the wrong idea entirely? Are we misusing Git?

道格威

推荐答案

配置文件背后的一般想法是仅置于源代码控制之下:

The general idea behind config file is to only put under source control:

  • 它的模板,
  • 能够根据本地数据(用户名,主机名,IP地址等)生成适当配置文件的脚本

另一种解决方案是与其他本地开发人员一起在dev分支中执行此操作,并添加

The other solution would be to do this in a dev branch, along with other local devs, and add a custom merge driver to merve merge back those config file modifications.
But that more complex and generally not needed if your template file is correctly built.

这篇关于Git rebase和每个开发者的半跟踪配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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