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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -