Re:High-Level Problems with Git and How to Fix Them
by maccam94 on Tuesday December 12, 2017 @04:48AM
(#15904223)
Some useful commands I'd use in scenarios like this are:
For your specific example, with a staged partial commit on branch idea-1, I would:
I do wish git had some notion of sub-commits with their own messages, and a better UX for cleaning up a set of commits before merging them.
[ Parent
| on HN ]
Re:High-Level Problems with Git and How to Fix Them
by mmebane on Tuesday December 12, 2017 @07:59AM
(#15905264)
> I do wish git had some notion of sub-commits with their own messages
You could use the "fast-forward with merge commit" style. [1] Then you can treat the commits from the branch as sub-commits, and the merge commit as the parent commit.
[1]: https://stackoverflow.com/questions/15631890/how-to-achieve-...
Re:High-Level Problems with Git and How to Fix Them
by maccam94 on Tuesday December 12, 2017 @02:14PM
(#15908504)
Interesting! That's almost what I want, except here's the specific behavior I want to achieve:
A clean git log view that shows only meta-commits
Git blame shows both the meta-commit and the sub-commit for each line
I suppose I could get creative by enforcing that tags be embedded in commit messages and then filtering them in the log view, but it would be better if it was standard.
Re:High-Level Problems with Git and How to Fix Them
by mmebane on Tuesday December 12, 2017 @02:33PM
(#15908704)
You can show only merge commits with
git log --merges
However, I don't know if there's any way to achieve that with git blame, and not all tools may offer that kind of log view.
Re:High-Level Problems with Git and How to Fix Them
by wutbrodo on Tuesday December 12, 2017 @12:16PM
(#15907325)
> I do wish git had some notion of sub-commits with their own messages, and a better UX for cleaning up a set of commits before merging them.
Does rebase -i handle this adequately or am I misunderstanding what you're describing here? My workflow sounds like exactly what you're saying here, where "subcommits" are my development commits and the UX is the rebase -i editor.
Re:High-Level Problems with Git and How to Fix Them
by maccam94 on Tuesday December 12, 2017 @02:18PM
(#15908557)
See my reply to mmebane about sub-commits. Re: UX, specifically the patch editor (git add/reset -p) is sometimes difficult to use. For example, I've had issues with changes that happen around empty lines refusing to apply for unknown reasons.