Live data from Hacker News

Ask HN: What is your Git commit/push flow?

news.ycombinator.com

21–30 of 201 posts

Re: Ask HN: What is your Git commit/push flow?

#21

I follow your flow, and I don't bother squashing my commits. So the repo history has lots of dumb little commits. We use a branch model for features, though, so I can just filter for those merge commits if I want to see granularity at the feature level.

Easier for you. Harder for who reads you history.

Re: Ask HN: What is your Git commit/push flow?

#24
post #21

I follow your flow, and I don't bother squashing my commits. So the repo history has lots of dumb little commits. We use a branch model for features, though, so I can just filter for those merge commits if I want to see granularity at the feature level.

Easier for you. Harder for who reads you history.

In addition it makes rebasing harder, which might make you use merge commits and then reading your commits gets even worse because changes might hide inside those merge commits.

Re: Ask HN: What is your Git commit/push flow?

#25
The most important git feature I discovered was `git add -p`, this allows both to select which patchs to stage, but also to do a review of what you are going to stage. Combined with `git commit -v`, this allows you to have plenty of occasions to review your changes before creating your pull request.

Shameless plug, but here are other efficiency tips I wrote about, for working in a high demanding environment: https://dimtion.fr/blog/average-engineer-tips/

Re: Ask HN: What is your Git commit/push flow?

#26
I do the same as you, get the work done, keep is stable. Being clean and pretty is the _last_ thing I do.

(based on years of experience with errors, failures, data loss, etc...)

edit: But I also now like to be messy in a dev branch, so it matters less in the grand scheme.

Re: Ask HN: What is your Git commit/push flow?

#28
1. Create feature branch

2. Make changes

3. Commit changes at whatever point and write a good commit message about the feature.

4. Commit more.

5. Create feature/branch_rebase

6. Squash all the commits.

7. Push to fork

8. Make pull request

9. Make fixes and push those commits per fix.

10. Squash when merging back to that first commit.

I like having a separate rebase branch because then I have all my work in one branch and the history of what I did. Then I squash it and get rid of the that history, then maybe rebase main back into it if there we changes since I started the feature.

Re: Ask HN: What is your Git commit/push flow?

#29

Earlier quoted context omitted.

...what is the golden rule of rebasing edit: googled, "Never rebase while on a public branch" i.e. a shared branch

It usually works out fine when you do a `git pull --rebase`, but not everyone does this or has it setup so pulling might have some nasty effects. Generally helps to consider a feature branch as a private branch. Don't push to other people's features without asking, don't fuck up other people's work.

Everyone absolutely should configure that. (Git config pull.rebase true.)

Such an annoying mess it leaves otherwise. And CI is building 'merge branch master', on the master branch, great.

Post reply on HN