By mistake I have Commited my code with wrong Commit Id number by follwing these steps:
git stash
git pull --rebase
git stash apply
git add .
git commit -m "commitId: msg"
git push
git fetch
But now I want to change my id. How can I do this ?
By mistake I have Commited my code with wrong Commit Id number by follwing these steps:
git stash
git pull --rebase
git stash apply
git add .
git commit -m "commitId: msg"
git push
git fetch
But now I want to change my id. How can I do this ?
With git amend
you can change commit message. Amend merges current change to the previous commit and will also change the commit hash and message.
$ git commit --amend --allow-empty -m "commitId: msg" # Commit empty change
$ git push -f origin HEAD # Force (-f) push as history is changed