wiki:github

Version 7 (modified by admin, 11 years ago) (diff)

--

Android and Github

How to use github for android developmen

Local manifest

In .repo create a file called local_manifest.xml to replace the original parts with your github forks. It should look like:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>  
  <remove-project name="Andromadus/android_frameworks_base" path="frameworks/base" />
  <project name="guhl/android_frameworks_base" path="frameworks/base" revision="jellybean" />
  <remove-project name="Andromadus/android_packages_apps_Settings" path="packages/apps/Settings" />
  <project name="guhl/android_packages_apps_Settings" path="packages/apps/Settings" revision="jellybean" />
</manifest>

Local branch and push

Create your local branch to work on:

git remote add origin git@github.com:guhl/android_frameworks_base.git
git remote show origin

If the remote branches are not shown as tracked do:

git fetch
git remote show origin

Checkout a branch

git checkout -b jb origin/jellybean

Now you can work on your local branch jb and push to the remote origin/jellybean

Update from original repo

Create a remote for the upstream:

git remote add upstream git://github.com/Andromadus/android_frameworks_base.git

Fetch the remote

git fetch upstream

Merge the changes

git merge upstream/jellybean

Update the fork from the local merge

Syntax is:

git push {remote} {localbranch}:{remotebranch}

which is in my case

git push origin jb:jellybean

Patches

create patch from uncommitted stuff

Write down die Hash of the last commit do a temporary commit. create the patch for the temporary commit:

git format-patch -1 <Hash of the temporary commit>

reset the temporary commit:

git reset --mixed <Hash of the commit before the temporary commit>

Check and apply patch

Check the patch:

git apply --check <file.patch>

Apply the pathc with am (that allows to sign off the patch)

git am --signoff <file.patch>

apply a patch an make it uncommitted

On the receiving side apply the patch as described above and the reset to the last commit before the patch using the "git reset --mixed <Hash of the commit before the temporary commit>" again