version control - Git: How to squash all commits on branch -


i make new branch master with:

git checkout -b testbranch

i make 20 commits it.

now want squash 20 commits. with:

git rebase -i head~20

what if don't know how many commits? there way like:

git rebase -i on branch

another way squash commits reset index master:

 git checkout yourbranch  git reset $(git merge-base master yourbranch)  git add -a  git commit -m "one commit on yourbranch" 

this isn't perfect implies know branch "yourbranch" coming from.
note: finding origin branch isn't easy/possible git (the visual way easiest, seen here).


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -