Mercurial and xcuserdata, .ds_store, and .git

試著忘記壹切 提交于 2020-01-02 04:47:27

问题


Mercurial noob here. I'm having a lot of trouble working with mercurial and files like xcuserdata and .ds_store and .git. I'm at my wits end.

The current setup has a central repo that acts like a middleman. We push and pull changes to it.

Commits were previously pushed that included unwanted files (xcuserdata, git, ds_store) before a .hgignore file was made. This has caused nightmares.

What I tried:

I tried ignoring the problem and letting merge handle it, but it causes branches on the central repo every push due to conflicts (conflicts on push aren't being shown in terminal so I don't get a chance to merge on push) and corrupts the project file to the point that it causes merge tools like filemerge and kdiff3 to hang.

I tried making a local .hgignore file and using hg forget on xcuserdata to stop tracking that stuff, but it still pushes and pulls those unwanted files.

What I want to happen:

I want the central repo to remove those unwanted files. Each developer should still have their own local version of those files. New commits will ignore those files. How would I do this?

Thanks


回答1:


Simply hg forget the files you want to remove and the push it to the server. The next time the rest of the team will pull from the repository, the files will be forgotten as well on their side.

Beware that forget only works for the current branch, if you have other branches, you must do it on each of them.

To automatically forget all files contained in the .hgignore, you can do

hg forget "set:hgignore()"

Be sure that every part of your team is aware of your decision about these files, otherwise it is possible they will add theses file again in the future. Communication is the key here !

FYI, .hgignore doesn't have any effects on file already in the repository, it only affects file that aren't added.

Otherwise, if you really want to remove the file totally from the history, you can use the MQ extension, but this is another story and it is much more complicated and useless IMHO.



来源:https://stackoverflow.com/questions/8129912/mercurial-and-xcuserdata-ds-store-and-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!