Skip to main content
Add Shell syntax highlighting
Source Link
Benjamin Loison
  • 5.5k
  • 4
  • 18
  • 37

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"
git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f
deleted 372 characters in body
Source Link
Ayan
  • 8.6k
  • 4
  • 48
  • 52

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

If your are using the above approach to simplify resolving merge conflicts, then I would rather suggest the following approach:

From your current branch, just do

git pull --rebase origin master

This will rebase your branch against master, and conflicts may come max once(instead of multiple times) since all your commits are put on top of master.

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

If your are using the above approach to simplify resolving merge conflicts, then I would rather suggest the following approach:

From your current branch, just do

git pull --rebase origin master

This will rebase your branch against master, and conflicts may come max once(instead of multiple times) since all your commits are put on top of master.

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f
added 222 characters in body
Source Link
Ayan
  • 8.6k
  • 4
  • 48
  • 52

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

If your are using the above approach to simplify resolving merge conflicts, then I would rather suggest the following approach:

From your current branch, just do

git pull --rebase origin master

This will rebase your branch against master, and conflicts may come max once(instead of multiple times) since all your commits are put on top of master.

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

If your are using the above approach to simplify resolving merge conflicts, then I would rather suggest the following approach:

From your current branch, just do

git pull --rebase origin master

This will rebase your branch against master, and conflicts may come max once(instead of multiple times) since all your commits are put on top of master.

Source Link
Ayan
  • 8.6k
  • 4
  • 48
  • 52
Loading