ruk·si

📁 Git
Extract Unrelated Commits

Updated at 2022-08-04 21:35

How to create another branch to contain unrelated changes.

git checkout my-feature
git rebase -i master
# move all stuff you want to split to the top
git push -f

git branch small-stuff
git checkout small-stuff
git rebase -i master
# remove lines that you don't want to include

git checkout my-feature
git rebase -i small-stuff

# create a pull request to get `small-stuff` merged to `master`
# then...

git checkout master
git pull
git checkout my-feature
git rebase -i master