문제

I created a new repository on my local computer, added files and committed giving me the following structure in my working copy:

-/a     
-/b

I want to push my initial commit to a remote repository on Bitbucket. I however want to ignore directory b so that it doesn't get pushed. I added

syntax:
glob b/**

to my .hgignore file. The b directory gets pushed anyways.

How can I prevent this?

도움이 되었습니까?

해결책

in .hgignore add:

^b/.*

or b/* if you are using the inferior glob syntax (regex gives you much more control).

The syntax is defined on the first line, and all rules are defined in following seperate lines.

if you want globbing, the first line would be syntax: glob and if regex, the first line would be syntax: regexp (implied by default). Refer to the documentation.

Note that mercurial does not actually push empty directories, so the only way you will be able to test it is if you have a file in b/

다른 팁

This cannot be done in Mercurial: you cannot push only an initial version of a file and then ignore later modifications. You can also not push part of a changeset — you either push the entire changeset or not. This way Mercurial makes sure you have a consistent snapshot of your project in all clones.

Preet is correct when he writes that the .hgignore file is a filter for untracked files. The .hgignore file is used to filter the output of commands like hg status and to filter the files added by running hg add with no further arguments.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top