I have a developer branch and I didn't push there but I have done more than 7 commits how it is possible from all commits to make one commit and then to push in the developer, because if I push in the developer it will sent more than 10 commits.
Asked
Active
Viewed 40 times
-1
-
3Possible duplicate of [Squash my last X commits together using Git](https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git) – Cory Kramer May 14 '18 at 11:23
-
@Phiter can you show me how --soft works ? by the way thanks for the responding – May 14 '18 at 11:24
-
https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git/5201642#5201642 – Vandesh May 14 '18 at 11:25
1 Answers
2
A good way to do this is through an interactive rebase.
You can use git rebase -i <base_commit>
.
Then you can pick the first commit and squash the rest.
That will merge your commits together in one.
Remember to not modify your already published history
There is a good guide here: Squash, reword amend

RandomSort
- 600
- 7
- 22
-
-
So let's say you have commit Q and the master branch points to Q. You then create develop branch dev pointing to Q as well. Now you do your work and end up with seven commits on dev. In that scenario you run `git rebase -i Q` – RandomSort May 14 '18 at 11:28
-
A reference of the commit you whant to rebase to. Just run `git log` command and check hash value for each commit. E.g. the `1eb193b445123ba53ca56bababa54a18b3da9187` value in `commit: 1eb193b445123ba53ca56bababa54a18b3da9187` commit will be the reference number you're looking for. – zinovyev May 14 '18 at 11:30