简体   繁体   中英

Reverting remote branch through PR to a specific commit

Basically I have a remote master branch that I do not have direct push access to. I've identified a commit say x commits ago that I want to revert the remote branch to. Is there a simple way to do this without having to revert all the previous commits before x?

I've attempted:

git checkout -b A_DEV_BRANCH
git reset --hard COMMIT_SHA_X
git add .
git push origin A_DEV_BRANCH

But that reports 0 changes through the pull request, and doesn't appear to remove the commits since X, feel like I might be missing something simple here?

The easiest way to do this was to track down the specific commit (y) that results in x being present in the remote branch then revert it using git revert y and committing the result back to master.

To do what I wanted to do is possible using git reset but would involve re-writing history and potentially causing problems for people who based their work off of in between commits to the remote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM