firstandthird / code-styleguide

Code styleguide
0 stars 0 forks source link

git styleguide #2

Open jgallen23 opened 11 years ago

jgallen23 commented 11 years ago

Would like to come up with a styleguide for git commits. Here is an example, it's probably a little too strict for my tastes, but it's a start

https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/

ghost commented 11 years ago

Where did you find this? I have started doing similar formatting in my commit messages, specifically using the body to explain more about my commit. I do like the very specific addition of .

jgallen23 commented 11 years ago

styleguide is from the angular project. Stumbled across is by finding this: https://github.com/btford/grunt-conventional-changelog

ghost commented 11 years ago

I really like the grunt task for that. Seems real solid. How does it compare to git-extras? Is that a replacement?

jgallen23 commented 11 years ago

the grunt task is a little smarter

ghost commented 11 years ago

Yeah, I really like that it allows for you to specify the editor so you can tweak if you want. Are you going to start using this rather than git-extras?

jgallen23 commented 11 years ago

not sure, have to try it.

jgallen23 commented 11 years ago

Here's another one: https://medium.com/code-adventures/a940ee20862d

I like the idea of prefixing and naming branches with “add”, “remove”, “update”, “refactor”, “fix”

ghost commented 11 years ago

Ahh, that's your boy. Its actually pretty good wrap up with some good techniques.

ghost commented 11 years ago

I'm also a huge fan of how tpope (http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) suggests commit messages. Combined with TJ's style, you have a real solid branching and commit strategy.

ghost commented 11 years ago

Oh and when you figure out what you'd like to do for commit messages, you can enforce the style using git commit templates

jgallen23 commented 11 years ago

Cool. I wish there was an automatic way to do that on the repo level

ghost commented 11 years ago

You should be able to. Its just a git config.

Finally, Git looks for configuration values in the config file in the Git directory (.git/config) of whatever repository you’re currently using. These values are specific to that single repository. Each level overwrites values in the previous level, so values in .git/config trump those in /etc/gitconfig, for instance. You can also set these values by manually editing the file and inserting the correct syntax, but it’s generally easier to run the git config command.

jgallen23 commented 11 years ago

but you don't check in .git/config, so if I do a clone, will the template settings come with it?

ghost commented 11 years ago

But you can check it into a build directory, and then symlink it?

jgallen23 commented 11 years ago

still means there's a step to create the symlink. We should probably investigate a little more

ghost commented 11 years ago

Oh I should have been more clear. It goes in the .gitconfig file within the repo.

[commit]
    # custom commit message template
    template = ~/.gitmessage
jgallen23 commented 11 years ago

So we'd check in a .gitconfig and a .gitmessage file. That could work.

ghost commented 11 years ago

Yeah, I'm pretty sure that would work. I'll check it out on my work computer. But I think that's how I'm doing it.