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?
Asked
Active
Viewed 203 times
-4
-
1Possible duplicate of [How to squash commits in git after they have been pushed?](https://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed) – phd Apr 06 '18 at 19:17
1 Answers
0
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:

jsageryd
- 4,234
- 21
- 34
-
The above mentioned process will work for already pushed commits right? – user9469186 Apr 06 '18 at 19:23
-
Yes. But since you are altering history, you will need to force push, to overwrite the history on your remote. – jsageryd Apr 06 '18 at 19:34
-
@user9469186 While it is possible with a "force push", it's best not to do this unless your certain that other developers have not pulled this branch - it will cause issues when merging their changes as well – Max Friederichs Apr 06 '18 at 19:44