I forked a repo on github, then I did git checkout X
and made some changes to branch X
. After finishing up, I made a pull request from branch X
of the forked repo to branch X
of the original repo.
My changes got merged with branch X
of the original repo, then I made some more changes and made another pull request from my branch X
to original repo's branch X
. However, this still shows my previously merged commits as under,
Here, commits made till Jul 05, 2017
have already been merged to branch X
of the original repo. I only need the commits on Jul 06
to show up on this pull request. After trying for quite some time I'm unable to find a solution. Here's what I did based on this post,
git remote add upstream https://path/to/original/repo.git
git fetch upstream
git rebase X
However, now I see an even bigger list of commits staged for the pull request. I'm sure I don't fully understand how pull requests work but I'm assuming this is because my forked repo does not know that previous commits have already been merged.
I know the usual workflow should be to fork the repo, make a new branch for every change, make a pull request, delete the branch once changes have been merged. I wasn't aware of that and stumbled on this problem. How do I only include the newly (un-merged) commits in the pull request, and not all the previous ones as well?