1

I have a git repository where the compiled version of my project is ignored in .gitignore.

When I release a new version of my project (tag the master branch to the version) I want to commit the compiled files, but then revert back to ignoring them.

is this possible? I would like to avoid committing a new version of my .gitignore every time I release a new version.

Matteo Pagliazzi
  • 5,140
  • 12
  • 49
  • 83

2 Answers2

0

You can do git commit -f file-in-gitignore (probably also git add -f file-in-gitignore). In general, it is a bad idea to include generated files, perhaps open a branch just for those files, or distribute them somewhere else?

vonbrand
  • 11,412
  • 8
  • 32
  • 52
  • but using git add -f then I'll need to remove them after I've tagged the new version... Yes and I'd like to avoid using generated files but I need them, at least when publishing a new version – Matteo Pagliazzi Feb 10 '13 at 12:27
  • @MatteoPagliazzi, no way around that I can see – vonbrand Feb 10 '13 at 12:30
0

When I release a new version of my project (tag the master branch to the version) I want to commit the compiled files

Why not.
I would simply recommend not doing it in the same referential.

A source version control system will retain the history of what you are putting inside, and binaries don't diff well, consuming space quickly.

An artifact repository (like Nexus, or other alternatives) is much more suited for that kind of release (for binaries or any kind of generated files), the idea being that you can very easily purge old releases from the referential (a simple flat files-based system).

Don't forget to include in your release a file text declaring the SHA1 or your source repo, in order to keep a link between the exact revision of your sources from which you produced said binaries.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250