11

I'm using the latest Truffle. Very nice, after having to roll my own dev environment in early 2016! But there is no obvious documentation as to what parts of the project need to be checked into Github.

For example, I'm unsure if the build directory needs to be checked in. I think the answer is 'yes' because one would want to remember what the format of the contracts that have been deployed, but I'm unsure.

6

This is the one I'm using rite now. I believe it may be helpful.

>$ cat .gitignore
contracts/.placeholder
test/.placeholder
build
node_modules
2

Consensys published an example project and it only has a key file which of course you shouldn't commit and node_modules.

deploy_mnemonic.key
node_modules
2

The answer probably should be - you MUST check in your build directory once you've deployed, because it caches the addresses of your contracts, which is absolutely critical to the truffle deployment system!

so:

>$ cat .gitignore
contracts/.placeholder
test/.placeholder
node_modules
1

I have never used truffle, but my view (and the general rule as I understand) when it comes to source control is that you commit any files and folders that you want to track that can not be recreated.

You should not commit the build directory because the built files can be.. rebuilt. Storing that data would be an unnecessary use of space/bandwidth.

It also necessitates good practices. For example you can build your code, and then modify the source (from which those files are built). If you submitted everything to source control (without rebuilding), another team member might check it out and work with the built files which in this case are not fully up to date.

A brief look at their website implies that this build folder holds compiled contracts. I would not call that a build, but hey-ho :)

In my opinion you would be best served submitting everything to source control except the build folder.

  • 1
    But if the network addresses are in these files that makes them important. And who cares about a few kB of bandwidth anyways. You should definitely rebuild and recommit the built files IMO (especially if your app uses the addresses like ours does). – JohnAllen Oct 27 '17 at 2:23
0

You could use one of the .gitignore on some well known ethereum projects on github. Try this: OpenZepplin's gitignore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.