I was just talking to another developer (more senior than I) and trying to convince him that we should implement continuous integration via Cruise Control. He told me that this will not work because he commits code that does not compile to the repository all the time for the purposes of backing it up. And that automated builds notifying us of failures would be just noise.
Committing garbage to the repo sounds bad to me. But I was at a loss of words and didn't know what to say. What is the alternative? What's the best practice for backing up your code on another machine without adding a bunch of pointless revisions?
BTW, our version control system is SVN and that probably won't change any time soon.
You should never deliberately commit broken code to a build branch. Any branch that is under continuous integration or from which releases or daily builds are made should always be in a potentially-releasable state.
Commit early, commit often If you are working on a feature branch that could take some time to finish, it helps you keep your code updated with the latest changes so that you avoid conflicts. Also, Git only takes full responsibility for your data when you commit.
The git commit command captures a snapshot of the project's currently staged changes. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to.
To pull up a list of your commits and their associated hashes, you can run the git log command. To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.
Develop in branches and commit ready to test and hopefully working branches into the main line. Let the continuous integration server depend on the main line (in svn most times called trunk) for new revisions to build and validate.
How exactly does everyone else on your team compile if he's checking in code that doesn't compile?
In general, I think it's a faux-pas to check in code to your main branch that does not compile; it's really inconsiderate to anyone else who's counting on being able to get latest from source control and build.
TFS has some nice features to help out this issue (shelve/unshelve); not sure if SVN does or not. Most of the time when someone is working on a huge change and they need to be able to check-in broken code, it's better to branch, and have them merge changes to the main line.
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