Live data from Hacker News

Tips for Intermediate Git Users

andyjeffries.co.uk

21–30 of 38 posts

Re: Tips for Intermediate Git Users

#21
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.

> No tips will help if the history is crap.

So there should actually be a history of histories :) Perhaps something for the git team to pick up...

Re: Tips for Intermediate Git Users

#22
I find this hardly informative. Those users who consider themselves intermediate already know all this stuff. When I clicked the link I thought I will see about interactive rebasing, advanced stashing and stuff like that. There are other things which are already mentioned by others but the tag handling advice is horrible. Tags are meant to be immutable milestones. Never change them and please don't encourage people to do so.

Re: Tips for Intermediate Git Users

#23
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.

I've seen a project where the lead guy wrote two scripts he called "git-rebase-merge" and "git-lock". Imagine when you have the ability to lock and rebase merge commits. This leads to an endless stream of errors and head scratching.

Re: Tips for Intermediate Git Users

#25
post #21
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.

> No tips will help if the history is crap. So there should actually be a history of histories :) Perhaps something for the git team to pick up...

Changeset Evolution[1], [2] to rescue. Mercurial only, though.

[1]: http://mercurial.selenic.com/wiki/ChangesetEvolution [2]: https://hglabhq.com/blog/2014/4/29/what-s-new-in-mercurial-3...

Re: Tips for Intermediate Git Users

#26

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.

Re: Tips for Intermediate Git Users

#27
post #14

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…

> Umm, you can do this, but in general you should never rename tags. Occasionally a developer will tell me the tag they pushed is incorrect and I'll agree to remove it only if they promise not to re-create it. If you read the man page on git-tag it's clear why you should avoid doing this. I'll take your word for it, but the git man pages are notoriously unreadable. They might be useful for a git guru, but for someone…

> I'll take your word for it, but the git man pages are notoriously unreadable. They might be useful for a git guru, but for someone that is learning the commands they are downright harmful.

Can you elaborate? I'm definitely not a git guru and I always read the man pages, and I find them quite readable. It's also the first place I learn best practices from.

Re: Tips for Intermediate Git Users

#28
post #27
post #14

Earlier quoted context omitted.

> Umm, you can do this, but in general you should never rename tags. Occasionally a developer will tell me the tag they pushed is incorrect and I'll agree to remove it only if they promise not to re-create it. If you read the man page on git-tag it's clear why you should avoid doing this. I'll take your word for it, but the git man pages are notoriously unreadable. They might be useful for a git guru, but for someone…

> I'll take your word for it, but the git man pages are notoriously unreadable. They might be useful for a git guru, but for someone that is learning the commands they are downright harmful. Can you elaborate? I'm definitely not a git guru and I always read the man pages, and I find them quite readable. It's also the first place I learn best practices from.

Sure. I think this is largely a matter of preferences in pedagogy, but when I'm looking to learn something, I like to have heavily annotated examples that get progressively more complex.

Listing every option with a description, to me, is not as useful as seeing it in practice.

Re: Tips for Intermediate Git Users

#29
post #24

Just to add some value to this post: http://ndpsoftware.com/git-cheatsheet.html This is a tremendous help for those folks who have not yet reached intermediate level.

Thanks! I'm intermediate in some parts of git and not on others, but since I'm a visual learner this layout really helps me see how the different commands relate to each other.

Re: Tips for Intermediate Git Users

#30
I've found in practice that using "stash" is a very effective way to ensure you'll spend lots of time in the future looking for a lost branch. I don't like stash anymore.

I like the idea of aliasing the command unstage, but once "reset HEAD" is in the muscle memory its kinda stuck.

Is git-flow still cool? Or is it so popular its just assumed to be in use as a standard, thus well beneath the level of an "intermediate" users guide? If you don't use "the" git flow repo, at least as a branch naming strategy and overall usage strategy it's worked pretty well for me.

Post reply on HN