简体   繁体   English

我如何在同一分支上工作,但排除了一些文件

[英]How i can work on same branch but exclude few files in mercurial

I have one branch named john which i am working in my office. 我有一个叫john分支机构,我正在办公室里工作。 Now i want to work from home so i have cloned the repo . 现在我想在家工作,所以我克隆了repo Now as my home computer has different settings so there are files like 现在,由于我的家用计算机具有不同的设置,所以有类似

settings,test1, test2 , test3 etc which i don't to track on my home computer. settings,test1, test2 , test3等,我不在家用计算机上跟踪。 I want to work on same branch as john and i want to commit to same branch as well. 我想和john在同一分支上工作,我也想提交到同一分支上。

How can i choose which branch i have to work. 我该如何选择必须工作的分支机构。 and how to ignore those files 以及如何忽略这些文件

  • Enable MQ extension 启用MQ扩展
  • Store skeleton files in repository 将骨架文件存储在存储库中
  • Add location-specific edits to files as MQ-patches in repositories 将特定于位置的编辑作为MQ补丁添加到文件中

I tend to keep default files in the repo, ones which don't actually work but don't interfere with the code that's in use. 我倾向于将默认文件保留在存储库中,这些文件实际上不起作用,但不会干扰正在使用的代码。 eg instead of having a file called settings in your repo, I'd have one called settings.default 例如,不是在您的仓库中有一个名为settings的文件,而是一个名为settings.default的文件

This can be kept safely in your repos and be populated with example data. 这可以安全地保存在您的存储库中,并填充示例数据。 Then when you clone a repo to a new location or machine you just copy the settings.default file to settings and add your location specific data. 然后,当您将存储库克隆到新位置或计算机时,只需将settings.default文件复制到设置中并添加特定于位置的数据。

You would ignore the plain settings file in .hgignore so it never gets pushed between repos. 您将忽略.hgignore中的普通设置文件,因此它永远不会在回购之间被推送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM