0

I'm new to Git,

I do development on a local host and do frequent commits, however, I don't want all this commit history to be shown when I push to origin. How to I achieve that?

Timus83
  • 681
  • 4
  • 12
  • 24
  • possible duplicate of [Compressing many commits into fewer, but larger, commits.](http://stackoverflow.com/questions/6218184/compressing-many-commits-into-fewer-but-larger-commits) – Tamás Jun 23 '11 at 08:28

2 Answers2

1

You can rebase and squash your commits.

Community
  • 1
  • 1
lprsd
  • 84,407
  • 47
  • 135
  • 168
0

I don't internals of git but following works for me.

git reset --hard <SHA of commit one commit before your first local commit > ( If commit order is RA-B-C if B and C are local commits RA is SHA you have to give) 

git merge --squash ORIG_HEAD

git commit

It will be great if someone can explain this.

Sirish
  • 9,183
  • 22
  • 72
  • 107