15

I'm trying to create the .gitignore file for an Altium project that is versioned with git and stored remotely on GitHub.

I don't want my teammates to continually struggle with having to update every single time I make a small change, like re-run design rule checks or re-compile the project. What are the minimum files I should I add to my version control system?

# Ignore the subdirectory where output job outputs are placed
GeneratedOutput

# Ignore autosave files (anything that begins with a tilde)
~*

# What else to ignore?
Lundin
  • 17,577
  • 1
  • 24
  • 67
tarabyte
  • 3,112
  • 10
  • 43
  • 67

4 Answers4

11

Here is the ignore list I use for managing Altium files in SVN. I'm sure they can be converted to a .gitignore format (if it's even needed) without too much trouble:

*/History/*
*.PrjPCBStructure
*.SchDocPreview
*.PcbDocPreview
*\__Previews
*\History
*.PrjPcbStructure
*~$*

Note that I disagree with @KyranF, you do not want to archive the prjpcbstructure files. They're entirely regenerated every time you compile the project, and there's not really anything in there anyways. They are functionally just build-artifacts, and those should not be committed.

Also, I've had my ass saved a few times by the History stuff, if a few hundred MB of local storage is a problem, you need 1. A bigger hard drive, and 2. To fix your priorities, if a few hundred MB is a serious consideration at all.

I also disagree strongly about committing gerbers. If you're trying to canonically link a actual PCB to a set of files, having the gerbers can be essential, particularly when things go wrong in the gerber export and/or processing stage. Admittedly, you shouldn't be comitting gerber files every day (you shouldn't be bothering to create them daily either), but you should ALWAYS commit (and ideally tag) each set of gerbers you release to manufacturing.


I think *~$* may be the temporary file indicator for SolidWorks, not Altium.

Connor Wolf
  • 31,938
  • 6
  • 77
  • 137
  • I guess gerbers generated for a particular "version" of a PcbDoc is important to keep together under version control, good point. And I was unsure about the prjpcbstructure file however seemed logical to me, given it may include information about what external files/sources were used during that particular compilation of the project and may help diagnose missing files later – KyranF Mar 11 '15 at 15:48
  • When you send a board off for manufacture, it's a good idea to zip up the entire folder of the PCB project (minus the history and other files crap) and freeze it in the state at which it was sent off - I've done this a few times, and also forgot a few times, and wish I'd been more consistent. – KyranF Mar 11 '15 at 15:49
  • @KyranF - A lot of the altium files are ASCII, including the `.PrjPcbStructure` files. You can look in and see what they encode. – Connor Wolf Mar 12 '15 at 02:26
  • fair enough, i'll have a looksie! – KyranF Mar 12 '15 at 03:16
  • The .PrjPcb files are also ASCII, which is convenient if you've moved stuff around. You can manually edit the file contents. – Connor Wolf Mar 12 '15 at 03:36
  • PrjPcbStructure is not really a build "artifact", since the hierarchical structure in the project view is wrong/not existent without it. However, you are right that it is (re-)generated on compilation. It doesn't really hurt to version it, since the structure won't change that often, and if it does, it is worth a commit anyway. – Rev Nov 04 '15 at 10:52
  • For the gerbers, it depends on how fancy you want to get with your workflow. The "best" solution is probably to have gerbers and other manufacturing output stored in a build artifact system as a "release" that includes the repository tag from when they were generated. This is probably most helpful if your project involves multiple co-designed PCBs, mechanical CAD, and FPGA/firmware code. For most people I think this is probably overkill, and just committing the gerbers to your regular VCS and tagging the repository is good enough. – Evan Nov 22 '16 at 19:38
3

As an addition to the other answers:

  • Do not version

    • Obvious files: Potentially all generated output, like BOM, report files and so on.
    • .Dat - Is (re-)generated as part of BOM generation. Does only seem to contain redundant information.
    • .TLT - GUI layout information.
    • .REP - Teardrop Report file.
  • Do version / consider versioning

    • Obvious files: .PcbDoc, .PrjPcb, .SchDoc, .OutJob, .PrjPcbVariants
    • .DsnWrk - I often find, that I open several unrelated PCB projects while working through the day, which results in changes to the workspace file. Since that is not relevant for version control, I tend to leave it out.
    • PcbLib, .SchLib, .PvLib - A project may contain some project specific libraries.
    • .PrjPcbStructure - Contains information about the hierarchical structure. It gets (re-)generated on compilation. Can be versioned, since when the structure changes, a commit is pending anyway.
    • .Annotation - Contains Board level component annotation information.
    • .Harness - Those files contain Harness definition and can potentially contain arbitrary definitions that can't be generated.
Rev
  • 10,017
  • 7
  • 40
  • 77
2

You want to version control the .prjpcb (assuming you have a PCB project!) , .prjpcbstructure, .pcbdoc, and .schdoc files.

The rest, such as the history, previews, gerber outputs etc are sort of transient files, not important to the project.

edit: also be aware of the huge size of "history" files, they can become many hundreds of megabytes, so you should adjust the history size in the project/Altium preferences to keep it under control, even if that whole folder is being ignored by sub-version file control, it will still eat up HDD space on your PC.

KyranF
  • 6,248
  • 16
  • 25
1

Since no actual .gitignore is posted in other answers (only the general guidelines and an SVN example), other answers discuss file types no longer relevant in modern Altium versions, and this is now one of the top results for Googling 'Altium gitignore', I will post this actual example used with Altium 21 and above (it might also work with lower versions, check the folder names however). This basically implements the answer of @Connor Wolf.

# Folders
**/__Previews
**/History
/Project Logs for*

# General reports
/*.html
/Project Outputs for*/*.drc
/Project Outputs for*/*.rep
/Project Outputs for*/*.html
/Project Outputs for*/*.txt


/*.PrjPcbStructure

It is debatable whether the reports are just transient files or are actually part of your project outputs; you can consider removing all report lines above, or at least the *.rep one, however I don't think that these general reports, generated by for example running a DRC check or any output job, are useful to include. Note that this ignore file, deliberately, does not exclude the specific reports inside the project output subfolders for those specific outputs, such as ODB and Gerber.

BrtH
  • 125
  • 9