Android OS Forum banner
1 - 8 of 8 Posts

·
The Jittery Gentleman
Joined
·
1,760 Posts
Discussion Starter · #1 ·
Hey all. I've been trying for days to familiarize myself with Github and how to push all of my work to it but I cannot for the life of me seem to make things work. I more or less have a blank account at the moment and would like to be able to push all of my packages/apps, framework/res and systemUI to it. Possibly push my entire CM10 source to it as well though I feel I should start small haha. Any help that anyone can lend would be greatly appreciated and I'd be willing to make a donation for a very well broken down how-to by someone knowledgeable. Thanks in advance!
 

·
Premium Member
Joined
·
1,768 Posts
This will sound silly but make a new test repo and read all the getting started page. After you make a new repo you will be presented with a page on how to init and push your first repo. They even have a guide to the ssh that is used as a standard across lots of git platforms including gerrit.

Follow the commands exactly as they should be copy pastable. Then let us know where you hit a bump because there are lots of git pros here :)
 

·
The Jittery Gentleman
Joined
·
1,760 Posts
Discussion Starter · #3 ·
This will sound silly but make a new test repo and read all the getting started page. After you make a new repo you will be presented with a page on how to init and push your first repo. They even have a guide to the ssh that is used as a standard across lots of git platforms including gerrit.

Follow the commands exactly as they should be copy pastable. Then let us know where you hit a bump because there are lots of git pros here :)
Ah JBird. I swear to god you are the most helpful person on this site haha. So I did what you said a few times and think I'm more being thrown off by the jargon and the order in which to do things. Every time I try to push to a new repo it comes up with some error about something not being referenced right I believe. I'm about to go try again but I'm trying to figure out how to push individual apks source while still being able to sync up to CM. Is that even possible? Also, I need someone to explain branches and forking to me. I have been trying to read up on them but my brain is having trouble with it haha. Thanks again man.

Sent from my Galaxy Nexus using RootzWiki
 

·
Premium Member
Joined
·
1,768 Posts
Thanks

Post the exact commands and the responses so we can see where its going wrong.

I'm going to try and make this as plain English as possible :)

Forking: so if I clone a cm repo (project) then push the code to my github then all the history is lost, and your basically taking credit for that code.

If however you navigate to the github page you want to mod and click fork github will keep all the history and have a forked from link under its name. (You can do this all via CLI obviously but I'm on my phone so this will have to do for now)

Branches: let's say I have a master branch that works but I want to work on a feature that isn't done or still needs work. I can simply create a new branch. The new branch will start tracking your changes from there without disrupting the original branch... later if your changes are positive then you can merge the new branch with your master branch, if your changes suck then no cleaning up needed to the main branch required.
 

·
The Jittery Gentleman
Joined
·
1,760 Posts
Thanks

Post the exact commands and the responses so we can see where its going wrong.

I'm going to try and make this as plain English as possible :)

Forking: so if I clone a cm repo (project) then push the code to my github then all the history is lost, and your basically taking credit for that code.

If however you navigate to the github page you want to mod and click fork github will keep all the history and have a forked from link under its name. (You can do this all via CLI obviously but I'm on my phone so this will have to do for now)

Branches: let's say I have a master branch that works but I want to work on a feature that isn't done or still needs work. I can simply create a new branch. The new branch will start tracking your changes from there without disrupting the original branch... later if your changes are positive then you can merge the new branch with your master branch, if your changes suck then no cleaning up needed to the main branch required.
Alright let me try and do this step by step haha. So if I synced up to CM and wanted to have all of those packages show up on my github what process do I follow and in what order? I think I understand forking and branching now but am still unsure of the process to get everything set correctly. Would I clone each package from CM's github into the source I already have synced up and that would then enable me to commit to my own github but stay up to date with cm? If that is the case, how do I name things and set up the repos on my github to interface with my source correctly? Baby steps at this point but yeah. Thanks again man. You are a savior.
 

·
Premium Member
Joined
·
1,768 Posts
so lets say you want to mess with the Phone app but you want to do it downstream for CM so you can keep your code merged up to date with your changes...

CM Phone app: https://github.com/C...ages_apps_Phone

so go fork that repo to your personal account
next clone it so you have the code locally

Code:
git clone [email protected]:UserName/android_packages_apps_Phone
since we still want to track the upstream, to keep you packages up to date, we will create a new branch for our changes
Code:
git checkout -b myAwesomeBranch
push your new branch to github
Code:
git push origin myAwesomeBranch
so now we have CyanogenMods code in the jellybean branch and your new branch

now lets start changing stuff
Code:
git checkout myAwesomeBranch #so your are making changes to your branch
*change stuff*

commit changes and push to github
Code:
<br />
git commit -a -m 'I changed x, y and z this is better because blah blah blah'<br />
git push origin myAwesomeBranch<br />
now we should check the upstream and merge any changes with our branch
so check the upstream
Code:
<br />
#move to main branch<br />
git checkout jellybean<br />
#add the cm as a remote<br />
git remote add parent [URL=git://github.com/CyanogenMod/android_packages_apps_Phone]git://github.com/CyanogenMod/android_packages_apps_Phone[/URL].git<br />
#pull the updated code from our parent (CM)<br />
git pull parent<br />
#move back to our branch<br />
git checkout myAwesomebranch<br />
#merge the updated code with our branch<br />
git merge jellybean<br />
#push the merge<br />
git push origin myAwesomeBranch<br />
 

·
The Jittery Gentleman
Joined
·
1,760 Posts
Discussion Starter · #7 ·
Alright so here is a pastebin for an error I keep running into. http://pastebin.com/VKnrRS6E I can't seem to push my new branch... I was running into this before... And I can;t say thank you enough. Things are starting to make a lot more sense now haha.
 

·
Premium Member
Joined
·
1,768 Posts
cd packages/apps/Phone; git remote add origin [email protected]:UserName/android_packages_apps_Phone.git; git fetch origin; git checkout jelleybean; git add -A; git commit -m "my sweet commit"; git push origin jellybean;

Do those commands one at a time and let me know if one fails all goes good you should have a new commit online.
 
1 - 8 of 8 Posts
Top