Git Revert to Tag and some changes and press start an error

advertisements

We have multiple branches and Tags in Git. I want to make my changes to previous tag and take a new tag out of it. To do that I use

1) Git reset --hard <tagname>

Did some changes to the files

2) git commit

When I am trying to Push my changes it says

 failed to push some refs to ""
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.

Any quick help


So basically you want to undo shared commits. You can push your modified branch anyway by forcing:

git push -f <remote_repo_name> <branch_name>

BUT, this is very bad if the branch you're editing has already been used by other developers and merged into other branches