I have mirror all android repository into my local repository, but with new version release I found it it hard to update from upstream.
Here is the detail:
After I mirror android source, my modification is in my own branch my-jb-mr1 on my private server. my-jb-mr1 is branched from aosp jb-mr1.
master
...
jb-mr1
my-jb-mr1
Now kitkat is release on aosp, I found I don't know how to update my private server to keep track on aosp. My idea is
merge aosp master to my local repository master, then push to my private server
branch the code based the branch node on aosp
But this seems does not work. Because the branch on aosp I want to keep track is kitkat-dev and kitkat-release. The master branch on aosp does not include all commits within the target branch.
What I want is to sync from aosp. After sync, the repository is like:
master
...
jb-mr1
kitkat-dev
kitkat-release
my-jb-mr1
kitkat-release and kitkat-dev should exactly the same with the branch on aosp.
Could any one give me some hint how to handle this case?
Normally the master branch of AOSP will be a superset of the most recent release branch, but I'm not sure that's the case right now and your question seems to confirm that. Don't expect it to be true all the time, especially not right after a release.
To push the Kitkat branches to your server, start by syncing a workspace from the AOSP servers:
repo init --mirror -u https://android.googlesource.com/platform/manifest -b kitkat-dev
Normally I'd suggest syncing the mirror manifest as described in the Using a local mirror part of the documentation, but right now the mirror manifest doesn't contain all gits that were added in Kitkat. I expect them to be added shortly.
When the sync is done, step into the workspace and push the new branches to your server:
repo forall -c 'git push ssh://yourserver.example.com/$REPO_PROJECT aosp/kitkat-dev:refs/heads/kitkat-dev aosp/kitkat-release:refs/heads/kitkat-release
You can also use wildcards to push all AOSP branches to your server:
repo forall -c 'git push ssh://yourserver.example.com/$REPO_PROJECT aosp/*:refs/heads/*
Related
I am new to Android Studio. I am wondering if I could create different branches to run my application. Likewise for example, if there is any possibility to have same copy of application but the difference would be just that ,one would run the production app and the other branch would run the test app.
So please suggest some method if available, to create branches or tags in Android Studio.
For this I would recoment to use gitflow here is an explanation image from nvie.com.
You can find the details in the link above. In short you use it to maintain features independed. You work on the development branch and your stable version is the master branch. So you can add fixes for the stable version without getting issues while fixing bugs with committed changes.
Back to your question how to add a branch in Android Studio click on the lower right edge in Android Studio and create that branch you want to:
If you need more information write a comment.
Create an account on github.com or bitbucket.com
then create a new repository for your project
Please read this git doc:
https://git-scm.com/book/fr/v1/D%C3%A9marrage-rapide
it's in french but there is an english version here https://git-scm.com :
in command line init git for your project:
cd ~/project-path-here
git init
git add .
git commit -am "initial commit"
git remote add origin <your link>
git push -u origin master
then manage your project with git.
You can create a branch with
git branch -checkout <new_branch_name>
Then you should be merge into your develop, release then master branch. You can use this git flow nvie.com
I'm working on a project where we have reached a milestone. My git repository is up to date and everything is working correctly. Our client has now updated their api's and we're unsure how it will affect our code.
What I want to do is create a branch (already done) and upload the full repository to the branch. So I will have the project duplicated, one in the master and one in the new branch. I will then work and commit to the new branch leaving the master untouched. So going forward then for each release I can do the same, so we can fall back to the previous branch if there's any problem.
Can someone tell me how to do this please. I'm using Git and I'm working through a mac terminal.
I've gone through relevant questions on SO but I don't see the info I require, or perhaps I've missed it.
You don't upload a repository to a branch.
You have your code in a repository, and the repository has branches. No duplication, but you can get (checkout) master or the branch to set your working files to the version you want: master for untouched changes, branch for your recent changes.
Always good to do when you have reached a milestone is to tag the commit:
$ git tag v1.0
Then from there you can start a branch to work on integrating the new API
$ git checkout -b client_api_update
Work and commit in your branch. It does not affect the content in master, which you can checkout when you want to get your working files as they were in your milestone version (or checkout the tag).
When the integration of the new API is done, it's time to merge your branch to master in order to release support of the new API:
$ git checkout master
$ git merge client_api_update --no-ff
--no-ff is optional, but I think it makes for a more elegant history.
You are at a new milestone, so tag:
$ git tag v1.1
Here is how your history would look like:
/- v1.0 /- v1.1
A---B------------------G - master
\---C---D---E---F-/ - client_api_update
Let's say the branch you created in the main repo is <main_repo_new_branch>. Then the steps would be:
cd <local_repo_dir>
git remote add mainrepo <main_repo_dir>
git push mainrepo <local_repo_branch>:<main_repo_new_branch>
cd <main_repo_dir>
git checkout <main_repo_new_branch>
I am learning how to use Git for version control. One of the uses of creating branches is to add new features while master branch contains the stable code. I am using Git Bash for Windows in conjunction with Eclipse for editing the code.
So, assuming that I want to create a new feature called social-share and a branch named the same, how would I go about doing that?
Wont I first have to create a branch, commit the entire master branch to it and then add new feature code?
So I'm assuming that you already have a branch called develop where your development occurs.
The first thing to do is create the feature branch based on the current branch and switch to the created branch
$ git checkout -b social-share
Optionally if you want to push that branch to a remote Git repo to track it there:
$ git push -u origin social-share
Pushing the branch to the remote repo is dependent on your environment and whether or not you want others to work on this branch.
Once you've finished your changes to the social-share branch you'll want to merge those back into your develop branch.
First switch to develop branch
$ git checkout develop
Merge social-share into devleop*
$ git merge --no-ff social-share
Delete social-share branch
$ git branch -d social-share
Push changes to origin
$ git push origin develop
* The reason you use the --no-ff flag is so the merge uses a new commit object and to avoid just fast-forwarding the develop branch which preserves the fact that the social-share branch existed at one point.
If you want to read more about this branching model then checkout the post it was based on. Also, if you would like to learn more about git branching by actually doing it there's a great tutorial series/sandbox that you should checkout (git it?).
I'm trying to do some contributing to Cyanogenmod. As per the directions at https://github.com/CyanogenMod/android_vendor_cm, I do the following:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
repo sync
And, as expected, after a few hours I have the CM source! However, the documentation at http://source.android.com/source/developing.html is a little confusing.
Basic Workflow
The basic pattern of interacting with the repositories is as follows:
Use repo start to start a new topic branch.
Edit the files.
Use git add to stage changes.
Use git commit to commit changes.
Use repo upload to upload changes to the review server.
Since the documentation states "Repo is a repository management tool that we built on top of Git." I assumed that once I initialized an android repo (and the fact that the URL ended in .git) the repo automatically would contain such an environment that I could use git. When I tried to follow the Basic Workflow instructions, however, git complained that it didn't find a git repository. This makes sense because I only saw a .repo directory, and no .git directory, like git expects.
So, then, do I need to initialize my own git repository? The instructions aren't very clear on that.
Thanks!
In order to gain git functionality you must initialize it as a git repository.
Try moving to the directory you cloned and type git init.
all
I have downloaded source code from google android website following google's guide. My purpose is to create a local branch to track remote branch
take framework/media for example, you can see .git under this directory, but when you run
git branch
the output is
*no branch
I crate my local branch using
git checkout -b local
then I have the problem, how can I switch back to track remote branch, I cannot pull updated source code from google for this .git again. There is only one local branch.
I also tried
git remote
and get
aosp https://android.googlesource.com/platform/frameworks/base (fetch)
aosp https://android.googlesource.com/platform/frameworks/base (push)
git branch --track local aosp
but I get the error
fatal: Not a valid object name: aosp
Anybody can give me some advice and guide? thanks very much.
You can use...
git branch --track local aosp/master
(The reason you're getting an error is because aosp is a remote, not a specific thing on that remote. aosp/master refers to the master branch on that remote, and thus can be tracked.)
As mentioned in "How do you make an existing git branch track a remote branch?"
As of Git 1.7.0:
git branch --set-upstream local aosp/local
will work too.
Note that for git 1.8+, discussions are in progress in order to make aosp/local an argument of --set-upstream (instead of a separate parameter).
In order to make its usage unambiguous, and to allow it to be used w/o specifying the current branch, require it to take an argument like so:
(master)$ git branch --set-upstream=origin/master