I have forked a repository, cloned it to get a local copy to work on two issues.Let's call them Issue 1 and Issue 2 . Firstly,I applied three commits which addresses the problem faced in Issue 1. Then I did git push origin master
to push the changes from my local master branch to origin/master. After this I sent a pull request to fix Issue 1. So Issue 1's pull request has three commits attached to it.
After that to address Issue 2, I created another branch called upstream
via git checkout -b upstream upstream/master
(I believe this adds a remote upstream (which is the same url as that of origin) and gives me a local branch upstream
which starts off from upstream/master
).
Now I make two commits to address Issue 2, cherry-pick the two commits with git cherry-pick <SHA>
(which just gave me 'nothing to commit' message). After this I did git push origin upstream
to populate the changes in my local upstream branch with that in origin. When I sent a new pull request to Issue 2, the three commits of Issue 1 got attached with the two commits I made to address Issue 2. Messing everything up.
(Later I also made a 4th commit to origin/master
to address a problem in Issue 1 which implies the pull request to Issue 1 ,now has 4-commits attached to it.)
Then locally I made a commit to upstream branch addressing Issue 2. What do I want now ? I want to be able to push this commit and update this commit to Issue 2's pull request ALONE and I want to separate the 4-commits involved in Issue 1 from the 3-commits involved in Issue 2.
Everything is a bit messed up as of now. I am new to git and github,can someone please help me with this ?