Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clean up GitHub pull request?

I have created and edited a fork, and submitted a pull request. However, there are many commits on it and I would like to remove some of the irrelevant ones. How do I do this?

I have looked at many other answers (such as this one), but they all address slightly different problems, and as I am new to GitHub I don't know how to put them all together.

Thanks.

like image 978
Frick Steves Avatar asked Aug 18 '26 13:08

Frick Steves


1 Answers

Interactive rebase works generally, and is almost always a better solution (details here). However, I had problems with it and had to go about it a different way.

1) Re-cloning your fork to another location, something like:

git clone /your-username/your-repo

2) Restart your fork from upstream (details here):

git remote add upstream /url/to/original/repo
git fetch upstream
git checkout master
git reset --hard upstream/master  
git push origin master --force` 

3) Replace relevant files within repo and commit changes. After making your necessary changes again:

git commit -m "<commit message>"
git push origin <relevant-branch>

Hope this helps someone some time.

like image 72
Frick Steves Avatar answered Aug 21 '26 13:08

Frick Steves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!