Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial and xcuserdata, .ds_store, and .git

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

like image 658
n a Avatar asked Oct 09 '22 11:10

n a


1 Answers

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.

like image 134
krtek Avatar answered Oct 13 '22 09:10

krtek