Solution for Merge multiple commits into one in git
is Given Below:
Commit 1 contains
I did some changes in
file2 and committed it as
But I want
commit2 to include both
file2 even though there is no change in
I would want a single commit that includes/merges both
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
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.