tl;dr
- I've forked a repo and made many commits on many files, all on the master branch.
- Now I want to create a pull request for all commits on select files, to send back to the original repo's author. For example, I want to send back some improvements, but not files I've added.
- I don't care if all the commits get squashed into a whole new one.
What I've tried...
I used Perforce most of my career and am still getting used to git, so I think I'm either not realizing that my scenario doesn't match the scenarios in the following posts, or I'm missing some implicit steps that are obvious to regular git users but not to me.
- Pull-Request for only certain files/commits
- Using GIT, how can I selectively merge changes from one commit on another 'fork'?
- Cherry picking changes to specific files from a range of commits
- How to git-cherry-pick only changes to certain files?
- How to cherry-pick multiple commits
What I'm seeing...
It seemed whenever I cherry-picked, I ended up with a branch with no changes (which makes sense though, since they're already committed to master, right?—then how do I create this "topic branch" I see being mentioned?) And now I have run several commands I don't fully understand (e.g. git remote add ...
) and also possibly interchanging the original author's repo versus my forked repo in them, so it's becoming hard to tell whether things aren't working because I've messed my environment up.
Cleaning Up
@Omer's answer worked great. I then did a
git reset --hard HEAD
to clean up. The original author merged the PR, and I sync'ed to it:
git remote add upstream git://github.com/<author>/<repo>.git
git pull upstream master