Live data from Hacker News

Tips for Intermediate Git Users

andyjeffries.co.uk

31–38 of 38 posts

Re: Tips for Intermediate Git Users

#31
post #13
post #4

The master tip: have a detailed written policy on git usage, on what goes into which branch, on git commit message format, and make really, really sure everyone understands it before they start anything. No tips will help if the history is crap.

Is there some kind of git plug in/linter that will check for commit style before accepting a commit? Basically, linting the commit messages.

a pre-commit git hook?

An example for jquery style commits is https://www.npmjs.com/package/commitplease

Re: Tips for Intermediate Git Users

#32
These aliases (from ~/.gitconfig) proved to be invaluable countless times, I hope someone will find them useful:

    [alias]
        logo = log --oneline --graph --all --decorate
	logg = log --graph --all --decorate
	logt = log --date-order --graph --tags --simplify-by-decoration --pretty=format:'%ai %h %C(Yellow)%d%Creset'
	ignored = ls-files --others -i --exclude-standard
Explanation:

    logo, logg - improved logs
    logt - log just tagged commits
    ignored - lists ignored files

Re: Tips for Intermediate Git Users

#34

This looks like a set of notes that are mostly correct but encourage bad practices. I think it's because they author doesn't understand git and doesn't know what they are doing. >A lightweight tag is simply a named pointer to a commit. You can always change it to point to another commit. Umm, you can do this, but in general you should never rename tags. Occasionally a developer will tell me the tag they pushed is inc…

> If you use '/' is branch names you can create path conflicts. You could say the same thing about filesystems though. Not sure this is an issue.

It's a gotcha for anybody, like me, that expects a branch name to be 'just' a string.

Re: Tips for Intermediate Git Users

#35
post #34

Earlier quoted context omitted.

> If you use '/' is branch names you can create path conflicts. You could say the same thing about filesystems though. Not sure this is an issue.

It's a gotcha for anybody, like me, that expects a branch name to be 'just' a string.

So you don't organize anything in a hierarchy ... how 1980s of you.

Re: Tips for Intermediate Git Users

#36

This looks like a set of notes that are mostly correct but encourage bad practices. I think it's because they author doesn't understand git and doesn't know what they are doing. >A lightweight tag is simply a named pointer to a commit. You can always change it to point to another commit. Umm, you can do this, but in general you should never rename tags. Occasionally a developer will tell me the tag they pushed is inc…

"I think it's because they author doesn't understand git and doesn't know what they are doing."

Thanks for your kind comment...

I would like to point out that this article is over 4 years old (hence my knowledge will have increased since then) and it was also basically my notes on our training with Scott Chacon of GitHub. I'm sure you wouldn't consider him to not "know what [he is] doing". Maybe it reflected best practices at the time the training was delivered and the article was written.

Anyway, I appreciate it's resurgence in popularity...

Re: Tips for Intermediate Git Users

#37
I replied to an individual comment, but I would just like to comment generally too - this article is 4 years old and if I wrote the article now there would have been more advanced information.

At the time beginners in git weren't doing much of this stuff, so they were tips for people who had used git daily, but this stuff wasn't common knowledge being done by all developers.

If anyone has anything they'd like to see in an advanced article, let me know and maybe I'll consider writing a "Tips for becoming an Advanced Git User" :-)

Re: Tips for Intermediate Git Users

#38
post #34

Earlier quoted context omitted.

> If you use '/' is branch names you can create path conflicts. You could say the same thing about filesystems though. Not sure this is an issue.

It's a gotcha for anybody, like me, that expects a branch name to be 'just' a string.

Yea, perhaps it's worth being explicit about it in the documentation, if it's not already mentioned.
Post reply on HN