管理git中的本地更改我从不想提交 [英] Managing local changes in git I never want to commit

查看:130
本文介绍了管理git中的本地更改我从不想提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有我更改的文件版本,这些都是非常个人的变化(例如关闭JavaScript构建的缩小)我永远不会犯。
但是我确实希望保持打开状态以便更新其他人的更改。



目前我必须在每次更新工作空间时进行堆栈保存

必须有办法做到这一点,请问这是什么?



编辑



我仍然希望在执行git pull时反映其他人的更改,因此我不能简单地忽略这些文件。



编辑2
我是一个承包商,无法开始告诉他们改变他们组织他们的git回购的方式。我已明确更改的文件是gruntfile.js一个构建文件。

假设您有名为<$ c $的配置文件c> myConfig.yml.dist (dist for distribution)其中所有人和每个人都进行了更改,并将它们推送到版本控制系统。

可以说你的数据库密码必须位于 myConfig.yml 中,但你永远不想将密码推送到版本控制系统。但是您需要本地来让您的应用程序正常工作。



所以,诀窍是每个人都会忽略 myConfig.yml

code>所以你的 .gitignore 文件应该包含一行说

  /config/myConfig.yml 

但是如果有人添加了一个新参数,他必须添加它 myConfig.yml.dist 文件。他会承诺并推动它。因为每个人都需要了解它。但是,您只需在 myConfig.yml.dist 中使用虚拟数据和/或注释。所以基本上你可以复制 myConfig.yml.dist myConfig.yml 添加正确的密码并运行应用程序。 / p>

So I have versions of files i have changed, these are very personal changes (for example turning minification off for a javascript build) That I am never going to commit. But I do want to leave it open for updating with other peoples changes.

Currently I have to do a stack save every time I update my workspace which is getting very annoying.

There must be a way to do this, please what is it?

EDIT

I still want other peoples changes to be reflected when i do a git pull, so I can't simply ignore these files.

EDIT 2 I am a contractor and can't start telling them to change the way they organise their git repo. The file I have explicitly change is gruntfile.js a build file.

解决方案

Say you have the config file named myConfig.yml.dist (dist for distribution) where all and everyone makes changes and pushes them to version control system.

But then lets say you have the databases password which has to be in the myConfig.yml but you never want to push the password to a version control system. But you need it locally to have your application work. Also your local database password might not be the same as the one running live.

So the trick is that everyone ignores the myConfig.yml so your .gitignore file should contain one line saying

/config/myConfig.yml

But if someone adds a new parameter he has to add it in the myConfig.yml.dist file. And he will commit and push it. Cause everyone need to know about it. But you kind of just have keys with dummy data and or comments in myConfig.yml.dist. So basically you can copy myConfig.yml.dist to myConfig.yml add the right passwords and your application runs.

这篇关于管理git中的本地更改我从不想提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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