>I also push often because I'm forever aware disks can fail. I'm not leaving a day's worth of work on my local drive and hoping it's there the next morning. I separate file backup and version control. I keep every git repository I'm working on in Dropbox, and don't ever worry about how often I'm committing and pushing. I don't think git should be considered a substitute for a proper continuous backup system.
Ask HN: What is your Git commit/push flow?
81–90 of 201 posts
Re: Ask HN: What is your Git commit/push flow?
#82Re: Ask HN: What is your Git commit/push flow?
#83Re: Ask HN: What is your Git commit/push flow?
#84My flow is: 1.a. a lot of dirty commits/wip commits 1.b. a few of clean commits, when I spot changes that I know they are already a commit by itself Before opening the PR: 2. `git log -p`: I inspect the commits I've done and I decide what should go together, what should be edited and what can stay as it is 3. `git rebase -i`: I apply the changes I've decided during 2 4. repeat 2 and 3 until I'm happy with the results…
Re: Ask HN: What is your Git commit/push flow?
#85Earlier quoted context omitted.
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.
Are there any downsides to doing this? Why isn't it on by default?
I think there's less argument in favour of merge than usual with pulls though - since it's much less like a semantic merge to begin with for git-merging to preserve a history of.
I'm certainly not aware of any objective downside/gotcha/'oh but it doesn't work when...', no.
The docs only add that you might further want to set it to `interactive` or `merges` rather than `true`, for the effect of rebasing with those options: https://git-scm.com/docs/git-config#Documentation/git-config...
Re: Ask HN: What is your Git commit/push flow?
#86>I also push often because I'm forever aware disks can fail. I'm not leaving a day's worth of work on my local drive and hoping it's there the next morning. I separate file backup and version control. I keep every git repository I'm working on in Dropbox, and don't ever worry about how often I'm committing and pushing. I don't think git should be considered a substitute for a proper continuous backup system.
Same. I used to make a commit every time I got up so as not to lose work, but that just littered the history. Then I switched to keeping it in Dropbox or using Syncthing for work stuff, so now I only have to commit when I get to a stopping point or to share with others.
Re: Ask HN: What is your Git commit/push flow?
#87Here's how I address this problem. When I'm developing, but before I create a PR, I'll create a bunch of stream-of-consciousness commits. This is stuff like "Fix typo" or "Minor formatting changes" mixed in with actual functional changes. Right before I create the PR, or push up a shared branch, I do an interactive rebase (git rebase -i). This allows me to organize my commits. I can squash commits, amend commits, mov…
The only problem I have with this workflow in the command line is that I would like to be able to split changes to the same file across multiple commits. I think some GUI tools enable this, anyone know about it?
Re: Ask HN: What is your Git commit/push flow?
#88There are two types of commit: checkpoints and versions.
Checkpoints are just you randomly deciding to "save" your progress. They don't necessarily correspond to completely working versions. The commit messages can be completely inappropriate for sharing but only make sense to you.
Versions are fully working copies of the program that could be checked out, run, released etc. These are what you present to your team and what gets merged in the end.
Sometimes you can write a new version straight away but other times you'll generate checkpoints first. Then you use rebase to get to versions. Use rebase as a way to make it look you are a superhuman writing perfect commits first time.
Getting good at rebasing takes some practice and pretty good understanding of git's data model. Learn this. And learn how to use --fixup, --squash and --autosquash to make your life easier.
Re: Ask HN: What is your Git commit/push flow?
#89The flow you use will typically depend on the company you are working for. Using regular git (no Github/Gitlab) will often have a different workflow than Github. My team (and myself) prefer this workflow: - One commit per PR. This allows for easy reverts and cherry-pick. - One developer per branch. You can do a few devs per branch, but rebases need to be coordinated and carefully handled, because: - No merge commits.…
I had never even considered that some teams might have multiple developers active on the same branch.
Re: Ask HN: What is your Git commit/push flow?
#90[1] https://stacked-git.github.io/ [2] https://en.wikipedia.org/wiki/Quilt_(software)
Edit: forgot to mention, once I'm happy with a given patch/commit, or series of patches/commits, I then cherry-pick or merge them from my patches branch over to the "real" branch, and then push them.