in Git by
Q:
How do you squash the last N commits into a single commit?

1 Answer

0 votes
by

There are two options to squash the last N commits into a single commit include both of the below-mentioned options in your answer

If you want to write the new commit message from scratch use the following command

git reset –soft HEAD~N &&git commit

If you want to start editing the new commit message with a concatenation of the existing commit messages then you need to extract those messages and pass them to Git commit for that I will use

git reset –soft HEAD~N &&git commit –edit -m”$(git log –format=%B –reverse [email protected]{N})”

Click here to read more about GIT
Click here to read more about Insurance

Related questions

0 votes
asked Jan 9 in Git by SakshiSharma
0 votes
asked Feb 17, 2020 in Git by SakshiSharma
0 votes
asked Feb 7 in Git by SakshiSharma
0 votes
asked Jun 8, 2020 in Git by DavidAnderson
0 votes
asked Jan 6 in Git by GeorgeBell
...