Cherry pick from local source - android

I am new to kernel building on android. I have a moto g. I used the cm source code and built a basic cm kernel. It booted. Now i want to cherrypick. I have cloned another repo. Now i want to cherry pick stuff into my kernel from that local source. I tried googling a lot but couldn't come up with a way. Can anyone help me?

Here I would like to share an idea to solve your problem.
Push the branch (where your stuff exists) from one repository to another where you want to cherry-pick your stuff.
For example, your stuff exists in kernel-1 repository on branch-1 branch and you want to cherry-pick your stuff into kernel-2 repository on branch-2 branch.
Go to kernel-1 repository.
$ cd $WORKSPACE/kernel-1
$ git checkout branch-1
$ git push $WORKSPACE/kernel-2 HEAD:refs/heads/branch-1
Now go to kernel-2 repository.
$ cd $WORKSPACE/kernel-2
And you will find branch-1 here. So you can cherry-pick your stuff.

I am assuming that you have two folder.
1. kernel (change will be cherry-picked into here)
2. optimus (change will be cherry-picked from here)
Go to optimus folder and craete a branch say, my-local-stuff from your stuff.
$ cd optimus
$ git checkout -b my-local-stuff <your stuff>
$ git push <absolute path of kernel folder> HEAD:refs/heads/my-local-stuff
Now go to kernel folder and you will find my-local-stuff branch.
$ cd kernel
$ git checkout my-local-stuff
$ git log
<you can see the commits which you have created into optimus folder>
Now cherry-pick the commit whatever you need into whichever branches.
Please let me know if more explanation is needed.

Related

git is unrecongised even I have installed it on my machine

In this tutorial they said:
To Clone volley you need to install Git GUI Client from (
http://git-scm.com/download ), I have installed Git GUI Client on my
windows machine After Installing Set the environment variable . After
Installing Git type the following below command line in your command
prompt.
git clone https://android.googlesource.com/platform/frameworks/volley
I have installed the gui git , and when I run the command I get git is unreconginised.
if I go to gui and and push to https://android.googlesource.com/platform/frameworks/volley they asked for username and password.
all I want is to clone volley and start using in my app. how to do that ?
Installing the git GUI vs installing git on the command line are different things.
When you download git, it should come with an application called git bash that looks like this
For Windows, you have to open this application which will come out with a terminal window of its own where you can perform git commands.
Keep in mind it has some basic things similar for navigation like in Linux (you can still use cd to navigate and wherever you do git clone, it will make the repo in that folder.
If you want to run git commands from command prompt, you need to check the option while installing i.e.
You can check if it's working on Command Prompt by typing git and you should see options come up.

Android source code, I can't get real source but only bare repository

I am starting to work on Android source code in Ubuntu and even if I am expert in Android App development, this part of Android is quite new to me so apologize for any stupid questions.
I started by creating my master branch locally with the following commands:
$ mkdir master
$ cd master
$ wget http://git.[myandroidrom]/repo
$ chmod +x repo
All working as expected, I end up with a folder called master and a file called repo inside it.
Second step I started the synchronization of my source code:
$ ./repo init -u http://git.[myandroidrom]/manifest -b [my specific rom branch]
$ ./repo sync
It took a while (few hours) after I got the folder master populated with all the folders mentioned into the Android source code documentation but they are all .git folders. So quite useless because in order to compile Android I need the real source code which is somehow packed into those .git folders.
What should be the next step to extract the content of this repository?
So actually the command repo sync create a folder .repo which contains the .git structure of android. If in the repo init you don't specify with -b a branch it will download the master branch.
After that, in order to have the real code you need to git clone the folder.
Example, I run the following command:
$ repo sync build
where build is the name of my project folder and in the root working directory I have now the source code for the folder build.
More info can be found at this URL:
https://source.android.com/source/developing.html

Git for my Remote Server for an Android Application

I'm running a remote Linode server - Debian 7.5 Profile (Latest 64 bit (3.16.5-x86_64-linode46))
A co-worker of mine already has an android application project locally on their machine.
I want to be able to transfer that project onto my server and adapt the git technology to it. So that it will enable me and the colleague to simultaneously work on the project.
How can I achieve this?
Are there any step by step tutorials on how to do this?
Thanks in advance
You might want to read this for using git on the server.
http://git-scm.com/book/en/v1/Git-on-the-Server
Tip. If you guys can use a shared folder (e.g., samba shared folder), just keep the common git repository there. Then you guys can clone it and push commits into the git not shared folder.
$ git clone samba_shared_folder_path
You can understand why it works after reading the above link.
Tip2, You can try the following at you local. (Just forget about 4-digit number)
a. make a local git repo and a commit
2037 mkdir common
2038 cd common/
2039 git init
2040 touch sample.txt
2041 git add sample.txt
2043 git commit -m "testing"
b. clone the commit.git into another folder
2044 cd ..
2045 git clone common my_common
2046 cd my_common/
2047 echo "new line" >> sample.txt
2048 git add sample.txt
2049 git commit -m "new commit from my_common"
c. push new commit from my_common(local) into common(remote)
2052 git push ../common HEAD:from_new_common
Just think about using a shared folder instead of common folder at your local.

Automation of GIT repo sync, get older commit versions, verify version

I'm very new at GIT, apologize if this is a basic question however I couldn't seem to find a similar situation after searching google and stackoverflow. Here's my scenario:
I have a git folder with the latest commit version that I do NOT perform any commit (I won't do any changes in the code in my local directory). Other people performs the commit on their computer, I just need to get a specific commit version, copy it to a working directory and build code. I'm planning to make a program to automatically perform these steps in repeated cycle everyday. Steps summarized below:
Get the latest commit in repo_folder
Go back to old commit version
Copy to a work_folder
Then build code in work_folder
I'm not sure if these steps are the correct/best way to do it. Also, how can I perform #2 correctly and how to make sure my program have retrieved the correct commit version? Is #3 necessary? Or can I just build code directly in repo_folder (might modify some files after build), then afterwards perform git command to get the latest commit version again?
Here's my steps actual steps
1. Get the latest commit in repo_folder
repo init -u ssh://username#git.aaa.com:1234/manifest.git -b branch -m file.xml
repo sync
After getting to the latest repo, I search through the logs and perform git reset --hard
2. Go back to old commit version
cd .repo/manifests
COMMITHASH=git log --grep=$keyword | head -1 | cut -d' ' -f2
git reset --hard $COMMITHASH
cp file.xml new_file.xml
repo init -m new_file.xml
After this command, I'm not sure how to check if my current version is correct.
Steps 3 and 4 just simple copy and build commands not related to this question.
cp -r repo_folder/folder1 work_folder/folder1
cp -r repo_folder/folder2 work_folder/folder2
run build.bat
Just clone your local master to a new directory and then checkout to the version that you currently need in that one:
No copying, no mucking about.
git clone -l /path/to/master /path/to/working
cd /path/to/working
git checkout -f REV_OR_BRANCH_ID
If you have any generated files such as objects it is a good idea to clean them up - such as with make clean after a checkout.
from then on you can:
cd /path/to/working
git pull
git checkout -f REV_OR_BRANCH_ID

Ubuntu - How to commit a whole Android project to a local respository?

Being fairly new to Linux and very new to Git, this is proving to be.. problematic.
Can someone please direct me to or tell me the steps required (Ideally step by step) to do this?
I have a directory with my project in it, I want to commit that to Git, I know there is a .gitignore which ignores certain files etc. and I have used GitHub on Windows mainly for local respository stuff which is again the primary purpose now.
Any help on this would be greatly appreciated cheers!
Welcome to git and linux. Here are a few links to get you started
https://help.github.com/articles/set-up-git
http://git-scm.com/book
http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository
http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html
Git for beginners: The definitive practical guide
There are a couple of different ways to do this. The easiest in my opinion is the command line.
Open up a terminal, and cd to the directory that contains the android project.
cd /home/bob/foo
ls
Initialize the git repo, this will create a hidden .git file inside the folder
git init
ls -a
Create your first commit, by adding all files to the working tree
git add .
git commit -m "My First Commit"
You will now have a master branch, and 1 commit. You can veiw your commit with the following commands
git status
git log
If you aren't comfortable using the command line yet, you could alternatively accomplish all of this with a gui. Here are some programs for linux.
https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Graphical_Interfaces
You can do a simple
git init
in the command line (in the correct directory) to initialize your local repository. Then you just have to add your files and commit them :
git add .
git commit -m "first commit"
I strongly recommand you the read of the first chapters (at least) of the Pro Git free book to help you understand the basics.

Categories

Resources