Merge multiple commits into one in git

Solution for Merge multiple commits into one in git
is Given Below:

Commit 1 contains file1 and file2

I did some changes in file2 and committed it as commit2
But I want commit2 to include both file1 and file2 even though there is no change in file1.


I would want a single commit that includes/merges both commit1 and commit2

Is there a way to do this in git?

Why do I have to include unmodified files in my commit?

My deployment happens using hash id generated as part of the commit. So in this case if I provide commit2 then it will include only file2, hence I would like to create a commit that includes the changes in commit1 and commit2. This may be an unconventional way, but this is my requirement!

git reset --soft HEAD~2

where 2 is the number of commit you want to rollback. After that, you will have all the changes you made in both commits as uncommited. You will need to commit again.