Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Before starting, you should make sure that git status is clean (i.e. there's no output from that command) to avoid losing work. The simplest way to do what you want is probably:

git reset --soft <LAST-COMMIT-THAT'S-OK>
git commit -m 'Many squashed commits'
git push --force origin master

You should bear in mind that this is rewriting history (that's why you need the --force option to git push) so you should avoid this if anyone else might have cloned or pulled from your repository. For some more alternatives, see this question and its answers:

Before starting, you should make sure that git status is clean (i.e. there's no output from that command) to avoid losing work. The simplest way to do what you want is probably:

git reset --soft <LAST-COMMIT-THAT'S-OK>
git commit -m 'Many squashed commits'
git push --force origin master

You should bear in mind that this is rewriting history (that's why you need the --force option to git push) so you should avoid this if anyone else might have cloned or pulled from your repository. For some more alternatives, see this question and its answers:

Before starting, you should make sure that git status is clean (i.e. there's no output from that command) to avoid losing work. The simplest way to do what you want is probably:

git reset --soft <LAST-COMMIT-THAT'S-OK>
git commit -m 'Many squashed commits'
git push --force origin master

You should bear in mind that this is rewriting history (that's why you need the --force option to git push) so you should avoid this if anyone else might have cloned or pulled from your repository. For some more alternatives, see this question and its answers:

Source Link
Mark Longair
  • 461.1k
  • 76
  • 420
  • 329

Before starting, you should make sure that git status is clean (i.e. there's no output from that command) to avoid losing work. The simplest way to do what you want is probably:

git reset --soft <LAST-COMMIT-THAT'S-OK>
git commit -m 'Many squashed commits'
git push --force origin master

You should bear in mind that this is rewriting history (that's why you need the --force option to git push) so you should avoid this if anyone else might have cloned or pulled from your repository. For some more alternatives, see this question and its answers: