I'm developing mobile apps (iPhone, Android, and Blackberry) and recently converted from SVN to Git.
In SVN after I do a release, I tag the relevant branch/revision to ensure its state is preserved and then I add a directory to this tag and put in the released binary and also (for iPhone) the debug symbols files for that exact build (for symbolificating any crash reports later on). The files don't need to be versioned, but it's a convenient place to store the historic artifacts along with the code to ensure they are backed-up (SVN has a backup policy whereas the builds on my CI server don't).
I'm trying to figure out the best equivalent in Git. Probably the closest thing would be to create a new branch, add the binary files, tag it, and delete the branch. However, I'm wondering if there are any better ways of doing this?
Ideally I'd like to create a tag and then attach the binaries as unversioned files to the tag. This way, they don't actually appear in the source tree but they are there in the repository, associated with the tag, for retrieval as necessary by anyone with access to the repository. Is there anything equivalent to this in Git?
A VCS isn't the ideal place to store any delivery element (like binaries), mostly because:
Deliveries are better stored in an artefact repository (like for instance Nexus), where checksum keys (SHA1, MD5) will be automatically computed and associated with those deliveries, ensuring you can get them back for using them in production while checking their integrity.
So that means having a separate repository (from the VCS one) in order to manage those elements.
As mentioned in Useless's answer, you could use git notes
to associate a binary blob to a git object (including a tag)
In principle, a note is a regular Git blob, and any kind of (non-)format is accepted. You can binary-safely create notes from arbitrary files using git hash-object:
$ cc *.c
$ blob=$(git hash-object -w a.out)
$ git notes --ref=built add -C "$blob" HEAD
The only issue is the size of the repo which can grow out of control, if those notes aren't regularly cleaned.
Another approach would be to use git-annex
, which allows to associate a git commit with an external content (meaning a content which can be a binary, as large as you need it to be).
git-annex
allows managing files with git, without checking the file contents into git.
While that may seem paradoxical, it is useful when dealing with files larger than git can currently easily handle, whether due to limitations in memory, time, or disk space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With