sdot257
sdot257

Reputation: 10376

How to clone and cherry pick changes from a git repo

We want to run the latest stable branch of Airflow but also cherry pick certain changes from master (bleeding edge). How would we go about cloning said repo in our own GitHub Enterprise server?

We have no plans of requesting pull requests, we leave that to the community. There may be a time where we would need to make a patch that only pertains to our set up but those would be rare.

Upvotes: 0

Views: 502

Answers (1)

anothernode
anothernode

Reputation: 5397

  1. Make sure your plans don't conflict with the license of the project you want to fork.
  2. Fork the repository on GitHub or GitHub Enterprise.
  3. Clone a working copy of your forked repo and cd into it:

    git clone https://github.com/your-org/your-repo

    cd your-repo

  4. Checkout the branch you want to cherry-pick to:

    git checkout the-stable-branch

  5. Cherry-pick the desired commits from master.

For the last step, there are many ways to do it. Here is an example given in the git documentation:

git cherry-pick master~4 master~2

Apply the changes introduced by the fifth and third last commits pointed to by master and create 2 new commits with these changes.

Upvotes: 2

Related Questions