How to rewrite history in git?

I cloned the project repository and made some commits. The charges were pretty dirty; I messed up the space tabs and did some trash along the way. Therefore, before making a pull request, I want to make things neat. I think the best way is to create a new branch in origin/master, and then apply the commits from my old branch one at a time to the working copy and execute clean commits to the new branch.

So how to apply commit from another branch to a working copy? Is this the best way to do this? Does such a task seem quite common, and perhaps there is already an established workflow and tools for such things?

0
source share
1 answer

, - :

img

g-h origin/master. -, origin/master, h:

git checkout -b new-branch origin/master
git checkout -b daughter-branch h

g

git rebase --onto new-branch g^
0

All Articles