.hgignore for basic yii2 template

I installed the Yii2 basic template on my web server, and all is working fine- but it is not clear to me how to now set up the version control environment for the basic template. I am using bitbucked/hg. my questions are

  1. does anyone have an example of a generic .hgignore file for the yii2 basic template that i could copy to get me started.

  2. could someone explain how then to set up the version control environment- in particular, how to populate my bitbucket repository with the basic template i installed on my server. if my web repository has a properly configured .hgignore file, then i am guessing that a push to the central repo will leave out required template folders (like runtime, assets?), thus when i pull or clone the central repo locally, the template files will be incomplete and not work locally on my pc. So, what do i do, and in what order to set up the VC environment after i have installed the yii2 basic template on my web server? I assume this is very simple and that i am missing the obvious, but I am new to all this so have mercy…


I haven’t used Mercurial in a while, but the last time I used it, my .hgignore looked like this:

I know: it is based on the advanced template, but it should give you a general idea.

Just look at the various .gitignore’s that is scattered across the Yii basic template’s directories and you have an idea of what to ignore. :)

thanks, i will look at .gitignore and your code- good idea.

how about the second part of my question- how do i push the files to bitbucket repo without .hgignore removing needed files- can you help me with this?

Clone your repository to another directory, apply the .hgignore and commit.

Do not push until you are satisfied.

If it does not look good, simply delete your clone and make another clone for take two.

As long as you remember to not push, you can do anything without fear.

If you screw up: no big deal.

Get rid of it, and clone again.

The problem is usually the opposite: adding a .hgignore will not remove already added files, if my memory is correct.