I can do basic git commands, but still run into trouble when I work on nested branches (instead of only 1 level away from main). I have an issue which I haven't found answered in other S.O. answers: my 2nd level branch has all 20+ commits from my 1st level branch in its history, when what I want to push (for ease of review) are only the 3 new commits since checkout.
I'm having a hard time understanding how to do this - it sounds ALMOST like rebase
but not quite (rebase would give the unneeded history, right?). Here's a similar question, but different in that I didn't squash
anything...
Full description of what I did:
- checkout new local branch ‘big feature’ off main
- Make 20 commits to ‘big feature’
- checkout new local branch ‘style edits’ off big feature
- Make 3 commits to ‘style edits’
- PR & merge ‘big feature’ into remote main
- Attempt to PR & merge ‘style edits’ into main, but issue: ‘style edits’ contains 23 commits
Diagram shows the unnecessary 'style edits' commits that now already exist on main - how do I get rid of those and only push the 3 new commits?