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

  1. create new branch commit #891273
  2. squash master new branch
  3. delete old master, , replace new branch

i not sure if might way it; thought wiser ideas, guidance , discussions it.

find easy way achieve requirement:

  1. git checkout –b branch1. create new branch commit #891273,

  2. git rebase –i master

  3. waiting editor input (type i start input):

    pick 176232 commit a

    squash ****** commit b

    ......

    squash 102381 commit z

note: type ‘esc’ button stop input

  1. 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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -