Hey, I'm very interested in this topic. I use a general template for commit messages that Linus himself suggested
Single problem is that when I'm doing let's say multiple commits on a feature, for the first commit I use the template(that i have set up as default) and for the other commits i use -m messages
When the feature is ready for Pull Request, basically i do an interactive rebase for the specific feature where I squash all the commits into a single one and use message template
After that I force a push on the feature branch and rewrite all the commits into a single one for a specific feature branch
Here is the message template:
<TICKET> Summarize changes in around 50 characters or less
If applied, this commit will refactor subsystem X for readability
If applied, this commit will update getting started documentation
If applied, this commit will remove deprecated methods
If applied, this commit will release version 1.0.0
If applied, this commit will merge pull request #123 from user/branch
If applied, this commit will <commit subject>
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.
Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequenses of this
change? Here's the place to explain them.
Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded
by a single space, with blank lines in between, but conventions
vary here
If you use an issue tracker, put references to them at the bottom,
like this:
Resolves: <TICKET>
See also: <TICKET>, <TICKET>
Acked-by: FirstName LastName<email>
Signed-off-by: FirstName LastName<email>
Awesome! Have you tried the "Squash and Merge" option at GitHub PR?
Also, this is a very well detailed template!
I think this is good for big changes as git itself doesn't have the concept of Pull Request and Linus receive the patches via email. For me, I prefer maintain the commits minimal and simple, describing each commit what I've done so far. Something like:
Totally agree, using the template I showed can be a real pain sometimes but after the feature is finished and all commits are squashed into a single one with the complex message it makes it easier over the year to keep track of the work on the project.
Thank you very much for your template, I want to take yours and add some details from the one I use for future reference
A Senior Developer working mostly with PHP and JavaScript, with a bit of Python thrown in for good measure, all on Linux. My tooling is simple, it's GitLab and JetBrains where possible.
I've used git for years, and I've still not managed to get my head around when to use rebase (and use it correctly) and when just to merge from a more primary branch. I always seem to screw stuff up with rebase, but merge can mean a lot of headaches with conflicts at times.
I know "rebase" causes a lot of misunderstanding for a lot of people and I already have this problems to start using this powerful feature sometimes ago.
I'm thinking to create a simple guide in practice about "rebase" and "cherry-pick" do you think it's will be helpful?
A Senior Developer working mostly with PHP and JavaScript, with a bit of Python thrown in for good measure, all on Linux. My tooling is simple, it's GitLab and JetBrains where possible.
If it's something which even a small number of people have a problem with, it shows that existing documentation/examples/guides are not covering the topic well enough. If you can create a guide which breaks down the concepts and reasons to use it in a way people get the message and can use it properly, then it's absolutely worth it.
IMHO the biggest issue with git is way too large repos and people who are using git wrong and create confusion doing so...
Also because it's so open, some believe they need to implement a new git strategy instead of using the ones available on the internet.
I've also seen repos without a strategy at all => nightmare ;)
I agree with you, that's the motive every team I have been working, we normally define a standard like "git flow" for branch's and some commit linter for messages, it's very helpful.
I am comfortable until there are merge conflicts or I need to revert some changes I've committed. My latest incident was where I didn't include a .gitignore and committed a bunch of files that didn't need to be committed. This SO post was a life saver. stackoverflow.com/questions/752798...
My biggest problem with git is the lack of having a time-lapse view of changes to a file over time, that would be akin to Perforce's time-lapse view (Perforce's killer feature).
That's not even close. A UI could be built on top of git that could mimic Perforce's time-lapse view. But in the meantime, it's the one thing in Perforce that I really miss that git does not provide. Including the various GUI front-ends I've used, not just constrained to the git command line.
I usually use git command line. I sometimes use Atlassian Sourcetree, or gitk.
For a git GUI, I was really enjoying Git Horizon (former-and-still-sort-of called Cycligent Git Tool), but it seems to have stalled out on a development a couple years ago... stuck on 0.5.2. Which makes me sad, because it's UI layout and visual metaphors clicked for me.
Some of the popular git GUIs just can't handle my project, because it's about a half-a-million files.
I switched from emacs to vim 20+ years ago, and have never been tempted to go back. I don't use the git addons for vim though, since the command line is plenty good for me.
Haven't started using Github because i am not sure how i would organize repos , i am used to folder structure where i have nested folders for different technologies. Github don't have that option, how can i put things in highly organized fashion
I don't know if I understand well, maybe share an example about what structure or organization do you want to commit and the way you are thinking about?
Hey, I'm very interested in this topic. I use a general template for commit messages that Linus himself suggested
Single problem is that when I'm doing let's say multiple commits on a feature, for the first commit I use the template(that i have set up as default) and for the other commits i use -m messages
When the feature is ready for Pull Request, basically i do an interactive rebase for the specific feature where I squash all the commits into a single one and use message template
After that I force a push on the feature branch and rewrite all the commits into a single one for a specific feature branch
Here is the message template:
Awesome! Have you tried the "Squash and Merge" option at GitHub PR?
Also, this is a very well detailed template!
I think this is good for big changes as
gititself doesn't have the concept of Pull Request and Linus receive the patches via email. For me, I prefer maintain the commits minimal and simple, describing each commit what I've done so far. Something like:The leged to it is:
type: feat, refactor, style, chore, fix...scope: not necessary but can give a little information about itshort description: describe in 50 letters or less if that commit is applied, what it'll dolong description: describe architectural choices, options, usage of code, why you pick your approach and things like thatreference: can be tickets, issues or external references to JIRA or other softwaresThis is what works for me! 😄
Totally agree, using the template I showed can be a real pain sometimes but after the feature is finished and all commits are squashed into a single one with the complex message it makes it easier over the year to keep track of the work on the project.
Thank you very much for your template, I want to take yours and add some details from the one I use for future reference
I agree with Ilê for minor tasks I like to do in the same way as he talked.
Personally, I think this more complete template can be applied to huge projects or more specificaly features.
I've used git for years, and I've still not managed to get my head around when to use rebase (and use it correctly) and when just to merge from a more primary branch. I always seem to screw stuff up with rebase, but merge can mean a lot of headaches with conflicts at times.
I know "rebase" causes a lot of misunderstanding for a lot of people and I already have this problems to start using this powerful feature sometimes ago.
I'm thinking to create a simple guide in practice about "rebase" and "cherry-pick" do you think it's will be helpful?
If it's something which even a small number of people have a problem with, it shows that existing documentation/examples/guides are not covering the topic well enough. If you can create a guide which breaks down the concepts and reasons to use it in a way people get the message and can use it properly, then it's absolutely worth it.
I'd certainly read it.
I will think in a more practical way to apply these concepts and share them with the community.
Thanks for your feedback!
IMHO the biggest issue with git is way too large repos and people who are using git wrong and create confusion doing so...
Also because it's so open, some believe they need to implement a new git strategy instead of using the ones available on the internet.
I've also seen repos without a strategy at all => nightmare ;)
I agree with you, that's the motive every team I have been working, we normally define a standard like "git flow" for branch's and some commit linter for messages, it's very helpful.
I am comfortable until there are merge conflicts or I need to revert some changes I've committed. My latest incident was where I didn't include a .gitignore and committed a bunch of files that didn't need to be committed. This SO post was a life saver. stackoverflow.com/questions/752798...
The
git rm --cached <file>is a life saver, thanks for sharing the post! :DMy biggest problem with git is the lack of having a time-lapse view of changes to a file over time, that would be akin to Perforce's time-lapse view (Perforce's killer feature).
I don't know about "Perforce's" but in Git you can see all the changes you have in a file, considering it isn't a binary file like "images", "psd's".
And to take control of every step you made in your machine, you have the access to
git reflogwho is a life saver in cases you need to undo something.That's not even close. A UI could be built on top of git that could mimic Perforce's time-lapse view. But in the meantime, it's the one thing in Perforce that I really miss that git does not provide. Including the various GUI front-ends I've used, not just constrained to the git command line.
I commonly use git just via command line or with Emacs + Magit (it's an amazing combination).
I usually use git command line. I sometimes use Atlassian Sourcetree, or gitk.
For a git GUI, I was really enjoying Git Horizon (former-and-still-sort-of called Cycligent Git Tool), but it seems to have stalled out on a development a couple years ago... stuck on 0.5.2. Which makes me sad, because it's UI layout and visual metaphors clicked for me.
Some of the popular git GUIs just can't handle my project, because it's about a half-a-million files.
I switched from emacs to vim 20+ years ago, and have never been tempted to go back. I don't use the git addons for vim though, since the command line is plenty good for me.
Nice to know about that.
Just curious, what make you go back to VIM instead of using evil mode into Emacs?
Haven't started using Github because i am not sure how i would organize repos , i am used to folder structure where i have nested folders for different technologies. Github don't have that option, how can i put things in highly organized fashion
I don't know if I understand well, maybe share an example about what structure or organization do you want to commit and the way you are thinking about?
The singe best resource for me when I was learning Git was Oh Shit, Git and it seriously helped with getting into it with confidence.
That's very nice! I really don't know about it.