3 ms·
git add --patch ...is your friend if you want to leave all your changes unstaged for awhile then break it out into multiple commits later.
by hypeatei 1y ago
git add --patch
...is your friend if you want to leave all your changes unstaged for awhile then break it out into multiple commits later.
- t-writescode 1y agoTo add, when I’m breaking my changes down into multiple parts for review, I tend to: * squash everything I’ve done into one commit * create a new branch off main/master that will be the “first commit” * cherry-pick changes (easy from some git guis) that represent a modular change. * push and make an MR from the new branch * rebase “the big commit” on top of the partial change. * wash, rinse and repeat for each change, building each MR off its requisite branch. The squashing part is vital because otherwise you enter merge conflict hell with the rebase.
- m000 1y agoHow about: * squash into one commit * git reset HEAD~1 * git add -p * git commit -m commit1 * repeat until no changes are left * add any file deletions/additions I use this because you can have several commits marked e.g. "commit1". Then you make a final interactive rebase to squash them together.