Vivek Sable
Vivek Sable

Reputation: 10221

How Remove commit from existing Pull request?

I have Project on BitBucket

There are branches like Master, Branch-test, Branch-dev

I want to update Code from my Local project i.e. Local Branch-test to Branch-test

I Commited code in resorptive branch i.e. Branch-test but during the creation of Pull request I add in existing pull request of Master branch.

Now I want to remove this from existing Pull request and do not want to delete existing Pull request?

Upvotes: 2

Views: 2931

Answers (2)

Awesim
Awesim

Reputation: 89

Since you're opening the PR towards the master, try this:

git checkout master 

git commit -m "removing a commit from PR"

git push origin Branch-test

I think this should do the trick.

The other solution is to amend or rebase after locally rewriting (removing) the commit and then force pushing it towards Github repo.

Upvotes: 1

VonC
VonC

Reputation: 1329672

You can remove a commit locally from your branch with an interactive rebase:

git checkout yourBranch
git rebase -i
git push -f

The Pull Request will update itself with the new history (published by a force push).

Upvotes: 3

Related Questions