Read here how to "reset" your changes
How to move HEAD back to a previous location? (Detached head)
Once you have the code you want it push it again to the repository. Since you did a revert and not reset you can simply push the code without any problem.
If you have done a reset
and you wish to update the remote branch you will have to force
push with the git push -f origin master
and this will result in a rebase which will affect all your co workers as well.
How can i get the changes again?
git cherry-pick
The easiest way is simply to do a git cherry-pick
to pick the desired commit back to your branch again.
# Find out the range of commits you wish to re-add to your branch.
# then use cherry-pick to add them back to the branch
git cherry-pick start..end
# If you wish to include the start commit as well add the ^
# This will result in a cherry-pick of the start commit included as well
git cherry-pick start^..end
git rebase --onto
(Carefull = rebase)
# reset it to the start commit
git reset --hard start
# rebase every commit after b and transplant it onto a
git rebase --onto commit1 commit2 commit3 ... commitN
