News for hackers. Stuff that matters.
Re:Show HN: Commit Comments – build commit messages in code ... by jedberg on Thursday January 14, 2016 @03:18PM (#10904115)
Presumably this is so you don't forget about a bunch of small changes when making a large commit. However, for me, right before I do a commit, I always do a diff to make sure what I'm about to commit is what I intended to, which has the nice side effect of seeing all the changes and reminding me for the commit message.

Is this not the common way most people commit?

Re:Show HN: Commit Comments – build commit messages in code ... by davegauer on Thursday January 14, 2016 @03:36PM (#10904270)
That's certainly how I do it. I find it very helpful to get a review of my changes, particularly before I begin on the next task.
Re:Show HN: Commit Comments – build commit messages in code ... by saurik on Thursday January 14, 2016 @04:40PM (#10904727)
I do a -p and work my way through all of the hunks, pulling out a cohesive "story" of multiple separate commits from the work that I did, sometimes editing hunks as I go to "backport" some changes to fit other parts of the story.
Re:Show HN: Commit Comments – build commit messages in code ... by dpcx on Tuesday January 19, 2016 @10:53AM (#10931486)
-p? Is this on git-commit, or something else?
Re:Show HN: Commit Comments – build commit messages in code ... by jtwb on Tuesday January 26, 2016 @02:33PM (#10975374)
git add -p
Re:Show HN: Commit Comments – build commit messages in code ... by joncalhoun on Thursday January 14, 2016 @03:23PM (#10904161)
I believe this is a pretty common thing based on personal experience.
Re:Show HN: Commit Comments – build commit messages in code ... by tylorr on Thursday January 14, 2016 @03:54PM (#10904410)
At this stage I also try to split up my changes into multiple commits, avoiding large commits.
Re:Show HN: Commit Comments – build commit messages in code ... by jedberg on Thursday January 14, 2016 @08:03PM (#10906283)
I do that as well, but in my branch. When I merge to master I tend to squash into bigger commits so as not to pollute the timeline so much. If someone really needs to see the small commits they can always look at the branch.
Re:Show HN: Commit Comments – build commit messages in code ... by wingerlang on Friday January 15, 2016 @05:32AM (#10908382)
I use SourceTree, which has the ability to stage individual lines (I know, git cli can as well). So even if I work on 2-3 things at the same time, it is trivial to select the correct changes for the commit.
Re:Show HN: Commit Comments – build commit messages in code ... by EvanPlaice on Friday January 15, 2016 @09:45AM (#10909561)
I use git cola for the same. It's a really light weight little tool that's surprisingly feature complete.

I usually make a bunch of changes at once. Following a break I review the changes and break them up into logical commits.

I aim do break up changes so that the commit log can be read like a book and. I can guarantee that not a single commit contains hidden surprises or unrelated changes.

I don't know how most devs get by with just the CLI. A lightweight gui makes commits and reviewing the history tree so much easier.

Re:Show HN: Commit Comments – build commit messages in code ... by eecks on Thursday January 14, 2016 @04:19PM (#10904568)
That's how I do it as well. It's a personal code review.
Re:Show HN: Commit Comments – build commit messages in code ... by sootn on Thursday January 14, 2016 @03:56PM (#10904419)
Checkout the -v option :)
Re:Show HN: Commit Comments – build commit messages in code ... by jedberg on Thursday January 14, 2016 @04:22PM (#10904587)
That doesn't seem to do anything for me. What am I looking for?
Re:Show HN: Commit Comments – build commit messages in code ... by chelmertz on Friday January 15, 2016 @10:24AM (#10909785)
You want the -v option to git commit, not to git add.

git commit -v displays the patch below the message part you're writing, so that you can review the patch as you write the message.

Re:Show HN: Commit Comments – build commit messages in code ... by jheriko on Thursday January 14, 2016 @03:30PM (#10904222)
doesn't this encourage the bad practice of doing large commits containing multiple things instead of independent and discrete changes?

i guess its still very useful if you are working somewhere where that bad practice is enforced.

Re:Show HN: Commit Comments – build commit messages in code ... by davegauer on Thursday January 14, 2016 @03:38PM (#10904288)
It could probably be abused in the way you describe. But I'm not sure it encourages it. I think it's a clever idea and seems like it could be handy even if you do nice, tidy commits.
Re:Show HN: Commit Comments – build commit messages in code ... by jheriko on Thursday January 14, 2016 @04:26PM (#10904616)
well, it seems not very useful if you are doing a discrete piece of work because you have one short comment to make, not a list...

maybe encourage is the wrong word, but it seems like a useless tool if you are doing things in (what i perceive to be) the right way.

Re:Show HN: Commit Comments – build commit messages in code ... by Zezima on Thursday January 14, 2016 @04:50PM (#10904815)
Agreed. My motivation for making this was the complete lack of detail in my peers' commit messages. They had no problem writing a semi-descriptive commit title, but glossed over numerous (yet small) changes entirely.

Ironically, this project I would not use myself! Mostly because I am in the practice of the Git workflow.

My goal was to make something which was easy to use, and gets someone in the habit of thinking about/listing all changes in a commit.

I certainly hope I'm not encouraging the bad behavior I'm trying to prevent!

Re:Show HN: Commit Comments – build commit messages in code ... by jheriko on Friday January 15, 2016 @07:20AM (#10908815)
i think encourage was the wrong word.

i can still see it being useful, like i said. well done for making something and sharing it like this.

Re:Show HN: Commit Comments – build commit messages in code ... by cphoover on Thursday January 14, 2016 @02:17PM (#10903657)
What advantage does this have over git blame view?
Re:Show HN: Commit Comments – build commit messages in code ... by WorldMaker on Thursday January 14, 2016 @02:28PM (#10903754)
Presumably the impetus is that if you fix a bunch of small things in a single commit it might be easier to compile the list of small things you changed by noting them as comments as you fix them rather than trying to remember them after the fact when it comes time to write a commit log for that commit.

That said, philosophically I'd personally prefer to just commit the small features individually as a set of small commits, therefore you get a better git blame/praise experience with the end result, but I realize there is a wide spectrum of preferences on commit size and style.

Re:Show HN: Commit Comments – build commit messages in code ... by Zezima on Thursday January 14, 2016 @02:45PM (#10903888)
Yes, that was my intention when making this project. I prefer the practice of making very small changes and committing frequently with opulent use of branches.

However, many of my peers and co-workers have a hard time following the small-commit workflow, so this project is really for them.

Being able to mark small (but significant) changes in your code as you code definitely helps reduce some ambiguity in commit messages.

Re:Show HN: Commit Comments – build commit messages in code ... by joncalhoun on Thursday January 14, 2016 @03:21PM (#10904142)
Some feedback on that regard - if you could note line numbers or anything really w/ some of these it would probably help more than just messages. Eg "Concatenated strings in HelloWorld.js#12"
Re:Show HN: Commit Comments – build commit messages in code ... by Zezima on Thursday January 14, 2016 @03:25PM (#10904182)
Having the source & line number makes these much more useful.

This is great feedback, thank you!

Re:Show HN: Commit Comments – build commit messages in code ... by volent on Thursday January 14, 2016 @02:28PM (#10903755)
It's not the same thing at all.

Git blame displays the last commits that updated your files lines.

This gives you the ability to write your commit description while you code.

Re:Show HN: Commit Comments – build commit messages in code ... by Arnavion on Thursday January 14, 2016 @02:31PM (#10903786)
git blame shows you commit messages for already-committed code.

This builds the initial commit message when you want to commit the pending changes in the index.