I want to implement featureX and I have committed it after writing it by
git commit -m "featureX"
After that I have done some changes and committed by
git commit -m "yo1"
squashed the commit by
git rebase -i HEAD~2
again some changes and committed by
git commit -m "yo1"
squashed the commit by
git rebase -i HEAD~3
Now git log shows -
featureX
yo1
yo2
I want to change commit message yo1 and yo2 to change1 and change2.
Also, I want to know that how can I see the changes that I have done in yo1 and yo2 because I have forgot what changes I have done in yo1 and yo2.
Squashing commit means generating a new hash id for your commit and merging your commit changes in one single commit. All the information in your commit tree regarding commits with commit messages yo1 and yo2 are lost now(merged in featureX).
However you can still see them if you know their commit hash id and also given that git haven't been through garbage collection. They would still be there lying detached from your branch as an object.
Do git reflog to find out the hash id associated with your commit message (yo1 or yo2).
Then you can simply git show hashid# to see the commit change you made there.
If you just simply want to change the commit message, it is much simpler and can be accomplished by either doing
git commit --amend
or
git rebase -i HEAD~1 (-i stands for interactive mode)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With