Hacker News new | ask | show | jobs
by qsera 28 days ago
People make this claim but it never made sense to me. How do you know the version that you are committing is buildable if you never tried building with it? And if you tried building with it, you can just do `git add .` or `git add -u` at that point.

So yes, your usecase does not make sense to me.

There was another comment that said similar thing...

https://news.ycombinator.com/item?id=48175289

>So you're just constantly committing untested versions of you work?

But it is "dead" for some reason...

1 comments

1. CI

2. Why should comments or printf statements affect the build? When it compiles with them, why shouldn't it compile without them?

3. the commits might be temporary and get squashed anyway

1. Not a very good reason. Some projects might have slow CIs. Some projects might not have a CI at all. Some project's CI might not be checking everything (front end for example)..

2. Because people make mistakes. You might think you are only excluding a comment, but might be excluding something that is required by mistake.

If I really want to make sure, I do:

1. git stash

2. build + test

3. commit

4. git stash pop

> Some projects might not have a CI at all.

Well, then you have bigger problems. Without CI, how would you even know if your projects compiles on other platforms?

When I really want to do your workflow, here is what I do. Add all the debugging print statements and commit them separately in another branch. When I want to include the debug statements, I just cherry-pick the commit with those things.

This way I remove the overhead of doing a staging before every damn commit and still retain the ability to pull in debugging changes whenever I want them.

>Without CI, how would you even know if your projects compiles on other platforms?

Not everything need to be cross platform! And not everything need CI..

This sounds more complicated overall. Also, I would still need the staging area to only commit the debug statements.

As I said, I like to work on several things in parallel and I don't want to switch branches back and forth. That's just my workflow for my own projects and apparently I'm not alone.