Git: remove commit in both source and reverse repo

My fork origin, and the one I'm fork ofupstream

I need to remove the commit from my plug, but I would like to update the repository upstreamin case other people need to unlock it (this is just me at the moment).

So far I have done the following:

git checkout MYBRANCH
git reset --hard <SHA_COMMIT_HASH>
git push origin MYBRANCH

My upstreamrepo is currently protected (it will be at some point), so I tried to click on this repo, but received the following message. I tried to force him, but that didn't work either. I checked twice and the branch is not protected.

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.
+4
source share
1 answer

You already have a reset commit. You can use 2 approaches

  • Push - git push origin --force-with-lease MYBRANCH. , , . ( , ), .
  • MYBRANCH. MYBRANCH .

,

.

  • git reset - , - .
  • git revert - ,

RESET, . reset , reset , .

REVERT, . ​​ . , - , .

, .

+1

Source: https://habr.com/ru/post/1696152/


All Articles