Reputation: 1565
Unfortunately after years working with subversion, I am trying to warm up with git. The problem is as follows:
Visually it looks like;
original project:
A->B->C->D->E
my own remote fork (x,y,z are my commits to revert or delete if it's possible):
A->X->Y->Z->C->D->E
I want my forked remote to be as the same as the original remote. However After i tried reverting (with git revert [HASH]) my commits one by one and pushing those reverts to my own remote, It seems the pull request did not disappear.
The last thing would be remove my fork, and refork the original project, if i could not get a solution.
Any suggestions before doing that?
Upvotes: 4
Views: 14175
Reputation: 1324278
Note: in term of PR (GitHub Pull Request), you now (June 24th, 2014) can cancel a PR easily
(See also "Reverting a pull request"):
you can easily revert a pull request on GitHub by clicking Revert:
You'll be prompted to create a new pull request with the reverted changes:
Upvotes: 2
Reputation: 124646
Assuming you have these two remotes defined in your local repo:
And you want to force update from origin/somebranch
to remote2/otherbranch
, you could do like this:
# make sure you have up to date branch data locally
git fetch origin
git fetch remote2
# force push to remote2 from origin
git push remote2 origin/somebranch:otherbranch --force
To reset a local branch to the same state as a remote branch:
git reset --hard origin/somebranch
Upvotes: 0
Reputation:
Let's say you're on your master branch and want to erase some commits, you could git rebase -i A
to run and remove the unwanted commits from your local repo. (there are some good git rebase -i
informations on GitHub)
You can then git push --force origin master:master
to overwrite the remote master
branch with your local one. (warning, I'm nor responsible for the lost code resulting of this :P).
For your pull request, that is more a GitHub issue than a git one, I think you can easily close it on the webpage.
F.Y.I. git revert HASH
actually creates a commit that negates the patch of HASH, it do not really revert anything as you intended it ;)
Upvotes: 1