github - Git Squash all commits in origin/master into single commit within origin/master -
i playing around git repository , made quite number of commits earlier on master branch. realised bit noisy, , merge of single commit.
102381 commit z .... 176232 commit 891273 initial commit
to simply
198273 initial commit (after rebase) 891273 initial commit
i have looked around , many of solutions seems around squashing. unfortunately might possible given on master branch already.
one of initial thoughts
- create new branch commit #891273
- squash master new branch
- delete old master, , replace new branch
i not sure if might way it; thought wiser ideas, guidance , discussions it.
find easy way achieve requirement:
git checkout –b branch1
. create new branch commit #891273,git rebase –i master
waiting editor input (type
i
start input):pick 176232 commit a
squash ****** commit b
......
squash 102381 commit z
note: type ‘esc’ button stop input
- input
:wq
exit editor, find want
note: when squashing commit z, may have conflict. need fix conflicted file, , use git add filename, git rebase --continue continue squashing
reference: https://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit
Comments
Post a Comment