How to undo a Git push?

Good day :)
Ask knowledgeable Git people help.
With git only work start and simplified I have formed here such situation:
I have a master branch and task1,
I'm in the thread task1 job and now want these developments to send to task1 branch on GitHub.
I am in the thread task1 and write like this:
git add .
git commit-m"comment"
git push origin master.

And it is necessary that after all had to write git push origin task1 =(
Now what needs to be done?
I googled, but not sure I found the right decision and I'm afraid to spoil your repository.
Plz tell me now what needs to be done?
July 8th 19 at 16:11
1 answer
July 8th 19 at 16:13
Solution
First send changes in the correct branch (in the remote repository and check that in task1, all changes were accepted, i.e. that the last commit was, otherwise there is a chance of losing all the work)
git push origin task1

Then the wizard get all the changes from the remote turnips
git checkout master
git fetch --all
git rebase origin/master

To oberseite changes and return them to the wizard with the force
git reset --hard HEAD~1
git push origin master -f
Thank you very much ! :) - eden_Mills commented on July 8th 19 at 16:16
> To oberseite changes and return them to the wizard with the force
> git reset --hard HEAD~1
> git push origin master -f

- why?
Without any special configuration git push origin master means git push origin master:master and not git push origin HEAD:master, so that the wizard that was, and will remain. - demetrius.Bedn commented on July 8th 19 at 16:19
Reset after changes. your local branch is behind remote.
As we will receive a message if we do it without affectation.
And so after reset we drop the last commit, works without any additional settings. - Kaylah_Mraz82 commented on July 8th 19 at 16:22

Find more questions by tags Git