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?

  • How shall I arrange merge from the master branch into my feature branch and commit of my own work on my feature branch?
  • Xcode: Could not read from remote repository
  • Git & Gerrit: how to avoid and eliminate unwanted dependencies in Gerrit
  • Branch model for multiple projects in the same repository?
  • Git Svn Migration - Handling directory of binaries
  • Git not recognizing any remote branches
  • “RA layer request failed: REPORT request failed” during git-svn
  • Clone git repository over ssh with username and password by Java
  • Git pull error: “fatal: Couldn't find remote ref master” from Heroku
  • How to tell Git to always pull the master branch?
  • What is the quickest way to manage Git over a network?
  • View a specific Git commit
  • 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.

    Example:

    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.

    Git Baby is a git and github fan, let's start git clone.