Interconversion of gitignore and hgignore?
Asked Answered
C

1

42

I'm just starting to use hg-git to push some mercurial repositories to github, and I'm realizing that if people check them out using git, they'll need a .gitignore file in the repository. Is there any automated way to convert hgignore to gitignore or vice versa?

Corenda answered 3/12, 2010 at 19:15 Comment(0)
M
31

If you're just using glob syntax in your hgignore, then all you'd need to do is rename it, and it should just work. If you're using regex syntax then it's going to be a different story...

Multiangular answered 3/12, 2010 at 19:45 Comment(7)
What about the line at the top saying "syntax: glob"?Corenda
It'll match a file called syntax: glob, which, presumably, you won't have :)Multiangular
That's not true, at least with git version 1.8.3.4 it does not work for every valid .hgignore expression.Forney
@AlexanderOrlov - can you elaborate on which ones don't work or provide a link? I'm just trying to use a hgignore formatted file in git now.Klansman
@Klansman Globs like /coffee/**/*.js don't work in hg.Goya
hg help patterns says ** should work: The supported glob syntax extensions are "**" to match any string across path separators and "{a,b}" to mean "a or b". ... may depend on your hg version.Rockwell
This .hgignore, although it has syntax: glob at the top, uses stuff like ^web/locale.* (looks like a reg.exp to me), glob:*Thumbs.db (pretty sure that won't work with git),Psychobiology

© 2022 - 2024 — McMap. All rights reserved.