GitHub: Apply master commits to another branch

The repository related to this question is located here.

I created a new branch called apt-offline-python3-dev from the master branch with the GitHub web interface.

What I want to do is take over the commits from the master branch from commit 774-784, and therefore make them belong to the apt-offline-python3-dev branch, instead of belonging to the master branch.

Because, when you look at the latest commit for example it clearly says master instead of apt-offline-python3-dev, which is logical because I sent all those commits to the master branch, before restructuring the repository.

I then want to reset the master branch back to its original state, which means back to commit 9f2f667d13 as seen on this page at Jun 16, 2013.

Now, I know about git cherry-pick and git merge, but don't really know if this is possible at all.

Update: +1 for Matt's answer leading me in the right direction. Unfortunately, there are still persisting problems. Here's what happens, when I issue the commands in the order Matt suggests:

git checkout apt-offline-python3-dev
Branch apt-offline-python3-dev set up to track remote branch apt-offline-python3-dev from origin.
Switched to a new branch 'apt-offline-python3-dev'

git cherry-pick 9f2f667d134330c0de8700258ab98cae0ac89438
error: could not apply 9f2f667... half implementation of lock, please verify
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

Because it already fails here, there is no need to invoke the git revert command.

Now, if one flips the order and replaces git revert with git reset --hard, it actually works:

git reset --hard 9f2f667d134330c0de8700258ab98cae0ac89438
HEAD is now at 9f2f667 half implementation of lock, please verify

git cherry-pick ba8662eb8e01cebc969126650baa22776a27430d
[apt-offline-python3-dev 78c9aa5] Another initial test commit
 Author: codingaround <>
 24 files changed, 1438 insertions(+), 1328 deletions(-)
 create mode 100644
 rewrite apt_offline_core/ (85%)

A git log reveals, that the hash is a new one:

git log
commit 78c9aa5b732d559f141c9bf77c801c1644710432
Author: codingaround <>
Date:   Mon Sep 30 20:11:55 2013 +0200

    Another initial test commit

The question that now remains is: How do I keep the commit hashes or is that not possible?


Use git cherry-pick to apply the changes from master to the desired branch:

git checkout apt-offline-python3-dev
git cherry-pick <sha1>
git cherry-pick <sha1>

Then, in a separate step, revert the changes to master:

git checkout master
git revert <sha1>
git revert <sha1>

(git revert will add new commits undoing the changes made)

Need Your Help

Restful authentication between two GAE apps

python google-app-engine rest restful-authentication

I am trying to write a RESTful Google app engine application (Python) that accepts requests only from another GAE that I wrote. I dont like any of the ways that I thought of getting this done, please

SnakeYaml dumping from String First Line

java yaml snakeyaml

I am trying to create a yaml file from pure java String. However, my created yaml file has the initial line as: