I might not have the terminology down yet. I made file to be added to a open project on git. I forked the project. I made some changes and my last commit is the file I want to request to the project and not the small changes I made before hand. When I go to github site and make pull request I get all the commits before the one I want which is last one of a file and I don't' want to submit all of the other commits because I don't think its necessary for the project. Just my own changes. What do I do? Should I just make another res or attach the file singularly and submit, if that's possible.
Cherry picking is the act of picking a commit from a branch and applying it to another. git cherry-pick can be useful for undoing changes. For example, say a commit is accidently made to the wrong branch. You can switch to the correct branch and cherry-pick the commit to where it should belong.
How do I pull a specific commit? The short answer is: you cannot pull a specific commit from a remote. However, you may fetch new data from the remote and then use git-checkout COMMIT_ID to view the code at the COMMIT_ID .
Turns out you can, indeed, "cherry-pick" just the commits you want from that pull request. Steps: Pull down the branch locally. Use your git GUI or pull it down on the command line, whatever you'd like. Get back into the branch you're merging into. You'll likely do this by running git checkout master.
Find the commits you want to pull into your branch. Go to either the git log or the GitHub UI and grab the unique commit hashes for each of the commits that you want. "Cherry pick" the commits you want into this branch. Run this command: git cherry-pick super-long-hash-here.
You can grab only specific commits with a very simple git command: git cherry-pick. Git's cherry-pick command allows you to "cherry pick" only the commits you want from another branch. Here are the steps to using it: Pull down the branch locally. Use your git GUI or pull it down on the command line, whatever you'd like.
Simply click Compare & pull request to create a pull request in the repository that you would like to contribute with only the changes you picked. Tada. You have done it=) Hopefully this guide has help you to create a GitHub pull request with a specific commits. Thank you for reading! I’ll try to keep this list current and up to date.
You need to create a fresh branch from the remote HEAD, cherry-pick the commit to that branch, push the branch to your repo on GitHub, then create a pull request.
git checkout -b mybranch
git fetch upstream
git reset --hard upstream/master
git cherry-pick <commit-hash>
git push origin mybranch:mybranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With