News for hackers. Stuff that matters.
Re:Coding tip: Leave your code in a broken state by wikwocket on Thursday January 16, 2014 @05:44PM (#7073025)
This is all well and good, but if you check in intentionally broken code, or if you fail to check in your code because it is intentionally broken, it will drive me bananas, and I will look for you, and I will find you.
Re:Coding tip: Leave your code in a broken state by RegW on Thursday January 16, 2014 @06:06PM (#7073123)
By "break", I assume he toilet or coffee.

So I assume he means code that he hasn't checked in yet, but might do when he gets back if he can't remember what was doing and it compiles.

Personally, I like to check in broken code late on that Friday evening before I take 2 weeks holiday. Unfortunately, these days with these new fangled source control systems you can't check it out again and keep it locked while you are away.

Re:Coding tip: Leave your code in a broken state by nickbauman on Thursday January 16, 2014 @07:41PM (#7073535)
I never check it in in this state. Checkins are 100% working and passing all tests for me.
Re:Coding tip: Leave your code in a broken state by krupan on Thursday January 16, 2014 @06:05PM (#7073121)
Have you heard of distributed revision control? Local check-ins are awesome.
Re:Coding tip: Leave your code in a broken state by pipeep on Thursday January 16, 2014 @06:10PM (#7073133)
Unfortunately, that doesn't keep some idiots from pushing broken code to `origin master`.
Re:Coding tip: Leave your code in a broken state by kodablah on Thursday January 16, 2014 @06:41PM (#7073267)
Why can they do so on a mature project? Why can they not only push to their branch, have the repo have commit/push hooks for fast linting, have CI builds for each commit, and only merge into master when comfortable (e.g. after QA)? And if it's a fairly new project and they're working in master directly, what's the harm of broken code?
Re:Coding tip: Leave your code in a broken state by jamesadney on Thursday January 16, 2014 @06:48PM (#7073294)
Even non-idiots make mistakes. Use the pre-push hook that comes with your repo: https://github.com/git/git/blob/master/templates/hooks--pre-...

Then, just mark your commits with WIP.

Re:Coding tip: Leave your code in a broken state by pdenya on Thursday January 16, 2014 @07:18PM (#7073429)
It's no trouble at all to work on a personal branch and merge it back in once it's fixed/complete. Especially if you're planning on doing it and are using a tool like git flow.
Re:Coding tip: Leave your code in a broken state by CUViper on Thursday January 16, 2014 @07:55PM (#7073596)
If you leave broken commits in the history, you'll make it very hard to use tools like "git bisect". You can "skip" broken commits, but that should be an occasional exception. It doesn't matter if that was on a personal branch either, because once you merge it's all part of the same graph of commits.

I have no problem with broken commits locally, but I don't want to see those in a public tree. Merge or rebase with squashing, please.

Re:Coding tip: Leave your code in a broken state by narsil on Thursday January 16, 2014 @09:34PM (#7073945)
A rebase in the personal branch that squashes the broken commit into the ones that fixed it would remove any traces of broken code in the master branch.
Re:Coding tip: Leave your code in a broken state by SideburnsOfDoom on Friday January 17, 2014 @04:56AM (#7075033)
> if you check in intentionally broken code ...

Agreed, but that's not what you should do.

Many times I have finished the day with a working commit and push, then I add a compiler-error "todo ..." line to the code locally so that it's clear where I have to resume tomorrow.