I needed to roll back a commit and locally it works fine. Now when I give PUSH to my repository, it gives me error.
git fetch origin c6f1668e2fac57401a99a2184a47f0b58c15e403 git reset --hard FETCH_HEAD git add . git commit -m "revrt" git push
! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitlab.com/XXX' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Now, if I give PULL back to a version I do not want.
What do I do?
Thank you! 🙂
This happens because the HEAD of the local repository is behind the remote, this means that git will not let you send new content without you making it clear that it is This is what you want.
Solution 1 (Recommended)
Working on a separate branch (or if you have already worked on the parent branch ), use git stash to separate the branchs ). Assuming you are working in the branch
develop and the main branch is
master , the stream would be this: