How can I do Squashing in git

I have made lot of commits for the same project. I got a comment from the customer to squash the commits. how can I do the squash through eclipse?


I don't know if or how you can do this from inside Eclipse.

From the commandline you can squash commits using interactive rebase.

git rebase -i <earlier commit>

This will open your editor. Change the commits you want to squash so that they say squash instead of pick . An example, squashing 753cafe Second commit and cddb7ca Third commit into 120c1b3 First commit :

pick 120c1b3 First commit
squash 753cafe Second commit
squash cddb7ca Third commit

Save and close.

This modifies history. If you have already pushed this somewhere and you need to replace that with the new history, will need to use force push. If others are working on or have based work off of your branch, this will affect them.

More info:

  • Pro Git - Rewriting History
  • man git-rebase
  • man git-push
  • 链接地址: http://www.djcxy.com/p/49054.html

    上一篇: 带有Rails的Backbone.js

    下一篇: 我怎样才能在git中压缩