Example '.hgignore' file for a Vaadin 8 project under Mercurial using IntelliJ

248 Views Asked by At

I am seeking guidance as to what files and folders I might consider ignoring when placing a Vaadin Framework 8 project into version control using Mercurial with IntelliJ 2017 IDE. I am looking for examples of .hgignore files to use.

I want to avoid the unpleasantness of later wrestling with the version control system to get it to forget files which never should have been included in the repository.

I create my Vaadin projects via the Maven archetypes provided by the Vaadin.com team.

1

There are 1 best solutions below

4
Basil Bourque On

While I am new to using Mercurial, here is what I've learned so far to ignore in my Vaadin projects.

The following are taken from my own .hgignore files using glob syntax rather than the regexp syntax.

  • styles.scss.cache
    Created when running the Maven lifecycle item install. I ignore this file per this advice by Mika.
  • target
    Ignores all the nested target folders re-populated when you build your Vaadin project. May have more than one, in a multi-module Maven project.
  • *.orig
    Such files are created by Mercurial to preserve contents of files being replaced by restored versions. In my limited experience, it makes sense to leave these around for a while before eventually deleting them manually, never to be tracked by my Mercurial repository. You may decide otherwise.
  • *.idea
    The folder where the IntelliJ IDE tracks the configuration of the project, such as the Settings/Preferences settings your may specify. The version control section of IntelliJ documentation suggests you include all but two files from this folder in your version-control system. That probably makes sense if you are sure to be working solo, never sharing development with a team or an open-source project. But if there is any chance of sharing, then I choose to ignore entirely the IntelliJ settings from my Mercurial repository, per this advice by marco.m. Note that you may have more than one of these folders in a multi-module project.
  • *.iml
    Ditto for *.idea above. This is the IntelliJ file for tracking your project.
  • .DS_Store
    A .DS_Store file is generated spontaneously by Apple macOS to track the arrangement of a folder. If there is any possibility of a Mac being involved with your project, include this to be ignored.

Here is an example of my .hgignore file.

syntax: glob
.DS_Store
*.orig
target
*.idea
*.iml
styles.scss.cache

Tip: After first running hg init to create your repository, you can create your .hgignore file, then check its effects by running hg status. The result of the status check lists all the files being considered by Mercurial. You can edit the ignore list and re-run the hg status to see the effects of your edits. Lather, rinse, repeat, without affecting your repository. Your new fresh repository remains pure and unaffected until running something like hg add and hg commit.