2
I did 3 commits in the local repository and uploaded them to the remote repository using push.
I noticed that one of the commits message was wrong. How do I change the message in the following conditions:
- Commit has already been uploaded to the remote repository;
- A programmer updated the local repository with the wrong commit.
- Another programmer updated the local repository and then made a new commit by updating the remote repository.
- Another programmer also updated the local repository, made a new commit but did not update the remote repository.
That is to say:
1. Repositóro remoto
o--->A--->B--->C
2. Programador X
o--->A--->B--->C
3. Programador Y
o--->A--->B--->C--->D
Repositóro remoto
o--->A--->B--->C--->D
4. Programador Z
o--->A--->B--->C--->E
Repositóro remoto
o--->A--->B--->C--->D
Assuming the commit with the wrong message is the B, how to fix the message?
There’s no way you can fix it, the only alternative would be if no one had done the
pull, you could fix it locally and make apush force, which is not cool because it totally changes the history of the repository and other users would have problems– user3603
@Gerep So what is recommended to do? A commit with a wrong message can also be problematic.
– Filipe Moraes
You can try using the command
git revert: https://git-scm.com/docs/git-revert =(– user3603