Splitting a Git Commit
blog.gnoack.org
Splitting a Git Commit
1–10 of 74 posts
Re: Splitting a Git Commit
#2Re: Splitting a Git Commit
#3Re: Splitting a Git Commit
#4It now has 5 upvotes. A long way to go to 2656 but at least it's going in the right direction.
Re: Splitting a Git Commit
#5> P.S. The stack overflow question for splitting commits discusses the old and cumbersome approach. The 20th answer discusses the right approach but has a meagre 2 upvotes as of today, compared to 2656 for the older top answer with the cumbersome approach. It now has 5 upvotes. A long way to go to 2656 but at least it's going in the right direction.
Re: Splitting a Git Commit
#6I never thought about whether this was possible, but now that I know it is, I immediately see how useful it could be for my workflow.
Highly recommend trying a good GUI out, I think you would likely have similar ah-ha moments about workflow optimizations, and honestly I just cannot understand how people get by in git without a convenient way to visualize the commit tree (and yeah I know there is a decent command line treeview, but the context switching all the time in the terminal to go from viewing the tree or even the simple log to exit out and ask for commit contents just is so much more fussy and tedious).
Re: Splitting a Git Commit
#7I never thought about whether this was possible, but now that I know it is, I immediately see how useful it could be for my workflow.
I had a team that insisted on a linear history and was constantly rebasing things. This workflow strongly favors "just squash it all together" before a rebase to avoid re-resolving the same conflicts. This workflow often produces big patches that reviewers end up asking to be broken back up. This experience and a recommendation from my manager at the time made a good git GUI like sourcetree a daily driver for me. It'…
Re: Splitting a Git Commit
#8git add -p is the real workhorse for the rebuild: s splits a hunk into smaller ones, and e lets you hand-edit the hunk when the boundary doesn't fall on clean line breaks. Stage a coherent slice, git commit, repeat until the tree is empty, then git rebase --continue. The rebase's only job is to drop you at the right spot; add -p does the actual splitting.
Re: Splitting a Git Commit
#9Re: Splitting a Git Commit
#10I never thought about whether this was possible, but now that I know it is, I immediately see how useful it could be for my workflow.
I had a team that insisted on a linear history and was constantly rebasing things. This workflow strongly favors "just squash it all together" before a rebase to avoid re-resolving the same conflicts. This workflow often produces big patches that reviewers end up asking to be broken back up. This experience and a recommendation from my manager at the time made a good git GUI like sourcetree a daily driver for me. It'…