Search code examples
gitgithubgit-branchpull-request

Git - How to create a new pull request without history


I'm trying to add new changes to a repo that I have forked onto my Desktop. I've already submitted 1 pull request with a branch called "network". However the pull request has not been approved yet.

Now I wish to make a new pull request with changes to a different file with a branch called "barcode". Since my old PR has not yet been approved, any changes I make to the "barcode" branch include the old commits made in the "network" branch.

What I need however is to have the changes made in the new branch "network" be excluded from the new branch "barcode".

You can take a look at my pull request here:

https://github.com/driftyco/ng-cordova/pull/9

I know this can't be too hard, I just can't figure out how to do it. I'm guessing that I'm making my new branch "barcode" wrongly, where it contains the edits I made in the old branch "network", and so my pull request contains the old commits too.


Solution

  • Try rebasing. I'm guessing you branched from the network branch when you created the barcode branch. That gives your source as the network branch. If you want to have a different point of origin you can either checkout master and create the new barcode branch from there, or if you've already done the work, you can rebase. Assuming you want to branch off master

    git checkout barcode
    git rebase master
    

    Check out this page for how it works.