Reputation: 12538
I accidentally pushed some 'in-progress' code to origin. I since committed and pushed some other changes to origin. After pushing everything and noticing the mistake of pushing in-progress code, I noted the commit hashes for the important commits and did a git reset --hard HEAD^^^^
, then I cherry-picked my commits, removing the in-progress commit from the stack, I then completed my in-progress commit and updated the commit message. I then force pushed to origin and got a message saying that everything is up to date.
Although, the git history and commit messages in origin are totally different than what I have locally. I'd like to force push and have origin reflect exactly the same commit messages that I have locally.
It seems the only difference currently is the commit messages.
Is there a way to update the remote commit messages with the local messages even if there isn't a diff
? or if there is no real difference between origin and local, there is no way to update the remote commit messages?
Upvotes: 1
Views: 301
Reputation: 22047
With a different commit hash (since the message enters in the making of the hash), your commit is just another commit to your remote repo, even with an entirely identical tree of files.
Yes, after the cherry-picking episode, force-pushing to the remote was indeed the way to go, so if you had an "up-to-date" message when pushing, it means that something here is not what you think. Either you're not pushing the branch you intend to, or there's something else you didn't describe.
Can you show how you pushed and the output you had?
You can also check with git log --all --oneline --decorate --simplify-by-decoration
to see where your different refs are pointing to (namely, your branch and its remote counterpart).
Upvotes: 2