You have different ways of do that. It depends on your case what is best for you.
Doing this, it will add a new commit on the commit history (you can see that using git log. If you run that command, based on what you described, it would be something like
commit <hash> (HEAD -> master, origin/master, origin/HEAD)
Author: Some Name <some-email@email.com>
Date: some date
Some message you wrote
commit <hash>
Author: Some Name <some-email@email.com>
Date: some date
Initial commit
once you run the git revert
command, you would see a new commit if you run git log
again
this other command will remove the commit from the log history. Using the --soft
param, will put your files that where in that commit ready for being commited again. If you use --hard
instead of --soft
, the files will be discarded. Once you fix whatever you need and make the commit and want to make the push, the command will have to be executed with the param --force
or --force-with-lease
(in the docs is well explained how they work). If you run git status
before doing the push, you would see a message saying that you have to make pull and also push due to some divergence. That's why you will need to add the param mentioned