Switch to a specific version of Android source code - android

I'm playing with the Android source code and I would like to switch to 2.3.3 and make some modifications from there. How do I do this?
More specifically, I made a git clone of the Launcher2 project and would like to switch it to the android-2.3.3_r1a tag. I tried,
git checkout android-2.3.3_r1a
but Git seems to think I'm trying to make a new branch instead.
I also tried
git branch -r
which listed
origin/HEAD -> origin/master
origin/eclair
origin/eclair-passion-release
origin/eclair-release
origin/eclair-sholes-release
origin/eclair-sholes-release2
origin/froyo
origin/froyo-plus-aosp
origin/froyo-release
origin/gingerbread
origin/gingerbread-release
origin/master
origin/tools_r7
origin/tools_r8
origin/tools_r9
and then
git checkout origin/froyo
but nothing seems to happen (files are unchanged) and
git branch
still outputs "* (no branch)".

all you need to do is git checkout -t origin/android-2.3.3_r1a. This will give you the branch you want and track the remote one.

Try:
git checkout -b android-2.3.3_r1a origin/android-2.3.3_r1a
Or:
git branch android-2.3.3_r1a origin/android-2.3.3_r1a
git checkout android-2.3.3_r1a

Related

How can I download the starter branch version of code [duplicate]

To cut the story short, to run a convolutional neural network model, I need an special version of nolearn, which has a url of the form https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn . However, there are no Download as Zip buttons at the page, nor I can download it with
git clone https://github.com/dnouri/nolearn -branch 1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn
Simply,
git clone https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn
does not work, too.
Even, I have no idea what should I search for in Google!
Note: This is the last version which provided support for the class Objective, i.e. the command from lasagne.objectives import Objective is no more supported!
This can help you:
How to clone a single branch in git?
Where specifies:
git clone <url> --branch <branch> --single-branch [<folder>]
Docu :
Git Clone
--[no-]single-branch
Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary
branch remote’s HEAD points at. When creating a shallow clone with the
--depth option, this is the default, unless --no-single-branch is given to fetch the histories near the tips of all branches. Further
fetches into the resulting repository will only update the
remote-tracking branch for the branch this option was used for the
initial cloning. If the HEAD at the remote did not point at any branch
when --single-branch clone was made, no remote-tracking branch is
created.
Other than in Subversion (SVN), git has separate namespaces for directories (file system folders), branches and tags. Thus https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn is not, per se, a branch. 1659e4811e498dc1f442d8e6486d0831f85255b4 is a commit ID, used here to refer to the revision created by the commit. dnouri/nolearn is the repository name on GitHub (repository nolearn on account dnouri) and the final nolearn in the URL is a directory within the content of revision 1659e4811e498dc1f442d8e6486d0831f85255b4.
The 'normal' way to get this code with git would be:
replicate the repository to your local machine
git clone https://github.com/dnouri/nolearn.git
(You can find this URL on the repository's page https://github.com/dnouri/nolearn, in the 'clone URL' field.)
enter the local repository
cd nolearn
check out the wanted revision
git checkout 1659e4811e498dc1f442d8e6486d0831f85255b4
change into the respective directory inside the repository
cd nolearn
This is the link to the .zip : https://github.com/dnouri/nolearn/archive/1659e4811e498dc1f442d8e6486d0831f85255b4.zip

Error when typing "git commit"?

I'm building a ROM but I need a commit into /frameworks/base repo. So i "git fetch" the Github repo and then I type "git commit xxxxx", but the output is:
error: pathspec xxxxx did not match any file(s) known to git.
Any help?
You need to do these things in order..
Fetch All Branches
git fetch --all
Check Branch Name
git branch
Then Checkout to branch
git checkout your_branch_name
Now, while committing
Add all files you want to commit in the staging area
git add . (for all files)
git add filename (for respective file)
Commit to local database
git commit -m "your custom message"
Push to remote repo
git push origin current_branch_name
Here, origin is the remote name.
Try
git checkout -b yourbranchname
And then try again.
I think you should clarify some concepts of git before using.
1) 'git fetch' only update those refs to remote branches, it do not merge remote modifications to your worktree. You need run 'git pull' to merge with your worktree.
2) you need a branch to work on. You can run 'git checkout -b' to create a new one, or 'git checkout --track' to create one tracking remote branch.

Cloning a subdirectory of a repository off GitHub using Android Studio

I was wondering whether it is possible to clone a subdirectory of a repository off GitHub using Android Studio? Usually when you clone a repository, you go "Check out project from Version Control" --> GitHub --> then you get something like this
However, for example, I would like to clone this subrepository as I would like to build the project and put it in my emulator. This address is https://github.com/hmkcode/Android/tree/master/android-material-design-appcompat.
I have tried to guess https://github.com/hmkcode/Android.git might have becomehttps://github.com/hmkcode/Android/android-material-design-appcompat.git, but this did not work.
Is it possible to clone this subrepository as I dont want the rest of the repository. I dont want to have to clone the whole thing and try to piece together the sub project.
This is not a "subrepo": it is just a subdirectory, and git reasons at the repo level.
You could use sparse checkout though, but it is not supported directly by Android studio. You would have to prepare your local repo:
mkdir hacker-scripts
cd hacker-scripts
git init .
git config core.sparseCheckout true
echo 'android-material-design-appcompat/' > .git/info/sparse-checkout
git remote add -f origin https://...
git pull origin master

github,eclipse and android

I'm new to git. I want to create a new project with Eclipse, and use Github to manage it.
The problem is, Github suggested me to add a .gitignore file to let it ignore files in bin, but once I did that, there is a new master in the Github's repository.
Then when I tried to push my project, it said:
To git#github.com:Benjaminz/SocialEventPlanner
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:Benjaminz/SocialEventPlanner'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
When I ran pull it said:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
What mistake did I make? How to correct this?
Thank you. :)
it seems that ur poject is not stashed
Do Below Steps :
git stash
git pull
git stash pop
For the second error message, you can type:
git branch -u origin/master master
Then try again your git pull.

How to clone a android open source project to my desktop

Essentially I am trying to clone this android open source project to my desktop.
https://android.googlesource.com/platform/packages/apps/DeskClock/+/android-4.3_r1
I am not sure what exactly to do.
I have tried:
git clone https://android.googlesource.com/platform/packages/apps/DeskClock/+/android-4.3_r1
But I got the error:
fatal: remote error: Git repository not found
So how would I have to create a repository and clone it in there?
I am just completely unsure on how to do this locally in my desktop.
The following works for me :
git clone https://android.googlesource.com/platform/packages/apps/DeskClock/
This would download the entire repository.
Then you can checkout any branch you want.
You will want to clone the base repo:
git clone https://android.googlesource.com/platform/packages/apps/DeskClock/
Dive into the directory it just created:
cd DeskClock/
Then you will need to checkout that tag you want to start from
git checkout tags/android-4.3_r1
First, verify the Git Repository URL you use is correct, as given in the official Git repositories on android
In Android Studio, Go for File > New > Project from Version Control > Git.
Paste the Git Repository URL (Don't include git clone here, only the URL)
Click on Test to verify
This should work, as it did for me. This procedure is simple and straightforward.

Categories

Resources