Choosing commits for separate branches of one repository
I have a documentation project at http://readthedocs.org/, which takes source from github repo. Since I’m not sure of the syntax it might need for one or another file I created a separate branch at github to push as many commits as I need there to see the result at http://readthedocs.org/.
I would like to be able to choose commits later on and push them to
master branch where from I will make PRs. Is there such a way or it is bad approach and there is something more appropriate for that?
One Solution collect form web for “Choosing commits for separate branches of one repository”
git cherry-pick should meet your needs. Documentation is here: http://schacon.github.com/git/git-cherry-pick.html
This allows you to select individual commits (from your branch) and apply them to your working tree.
jayray @ myrepo > git log commit fd7aafce97949da4f80d5fd08b5d9bcc5e85b565 Date: Mon Apr 16 16:50:52 2012 -0400 added d commit 9b40ed02b0d594391e81c0f19883f4bc05d8751c Date: Mon Apr 16 16:50:47 2012 -0400 added c commit 4359f39765aac74509a4ed876ba1266a2624797e Date: Mon Apr 16 16:50:41 2012 -0400 added b jayray @ myrepo > git checkout master Switched to branch 'master' jayray @ myrepo > git cherry-pick 9b40ed02b0d594391e81c0f19883f4bc05d8751c [master 3b78d02] added c 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 c
So this allowed me to apply a single commit from my branch to my master. You can specify multiple commits as well.