I have a whole android project code,it is very different from google's,because a team have developed on it for one year.Now I decide to use git instead of svn.And I want to use repo script to maintain the project.How to transfer?I've try to mirror a git server from Google via
repo init -u https://android.googlesource.com/mirror/manifest --mirror
then build my branch,but when I merge my project code to it,it is too difficult.
Is there a easy way?Thanks!
I am working on this same issue, the most progress I have made is due to this google group discussion.
From what I can tell you are going to have to maintain projects individually using git (I think you can do a repo start instead of git branch to setup your branches, then when you are ready to push changes you can use git push to the mirror. The thing you can gain from the repo script is the ability to use repo sync to sync all of the projects, and repo start to make new branches.
Could you be more specific about the problem you ran into with the merge? I may be able to help more on that front.
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
This question already has answers here:
How do you synchronise projects to GitHub with Android Studio?
(13 answers)
Closed 5 years ago.
I'm using Android Studio to code my apps. Now I want to work on 2 PC's and thought about using a Cloud-Service. I decided to use GitHub, but I can't find a way to synchronize my GitHub account with my Android Studio project...
Can anyone explain this to me ?
Best way to do this is probably through the good ol' command line. First, make sure you have git installed and in your path. You can get instructions from here.
Next, go to GitHub and create a new repository with a title and such. Instructions on that here. Don't worry about creating your first commit, we're going to do that on your local machine.
Now for the fun part.
Copy the repo link of your choice (I prefer ssh, but it depends on how far you went with the set up part) and head to the terminal.
cd ~/project-path-here
git init
git add .
git commit -am "initial commit"
git remote add origin <your link>
git push -u origin master
If all has gone well, you can reload the github page and see your new push.
On your other computer, you'll be able to clone down the repo you created.
cd ~/project-path-here
git clone <your link>
You can then use git pull and git push to retrieve and send changes to the server.
You can also look into Github's desktop application if you're on Windows or Mac for a simpler time, but I find these lack some more advanced features of git.
EDIT: To register your new git repo with Android Studio, Intellij, RubyMine, etc., go to the project settings (File->Settings), search for version control, and specify that your project is using git for version control. Here for more information on that. Once that is enabled, the VCS drop down will have more features. The ones to look at are Commit Changes (git commit and push) and Update Project (git pull).
Under the VCS tab in your Studio, there's on option to publish the project to Github. Will ask for your credentials, then you're good to go to push your code.
Just getting into Android app dev and I thought I might mention here that I think that we should gitignore the build folder. It's huge and it doesn't need to be repo'd
[Edit] I'm referring to the app/build folder. And hey I see it's not included in the Android Studio .gitignore
Supposing I have made a silly error of never branching after I fetched a remote repo. how would I go about getting a patch that covers all the changes I made on a local copy?
some time ago I did a
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.3.1_r1
$ repo sync
and brought down the 30Gb source of android, I was following a readme and didn't know about git at the time. So I then applied a bunch of patches and then made a bunch of changes myself. Only recently have I made a branch. And now I'd like to be able to create a set of patches that will make it possible for others to generate the head that I have locally. Is there anyway I can do this without fetching the whole repo again? I tried to use the answer on giff cloned...
but it seems to be comparing me to the current version of android and not the -b 4.3.1 version. How do I incorporate this into that answer?
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.
When I wanted to get Android source code, I knew that I have to use "repo". So what is repo? Why do they use repo and not just use GIT?, and is there a GUI for repo that enables me to pause/resume syncing, because every time I get disconnected occasionally it seems that repo starts syncing from the beginning!
As is mentioned in the android webpage, repo does not replace git. It is just a tool over git and helps you to manage multiple git repositories.
For example, suppose I have a big project which has a lot of features and I have several teams working on each feature and I created one repository for each feature. For example suppose my repositories are wifi, telephony, power management, etc. This action has sense when your features have different life cycles. For example if I won't touch the wifi feature in my next release and but I will modify all the rest. So under this scenario, my project or product is distributed in several different git repositories.
So, to get a centralized photo of my project (one specific moment of my project, for example a milestone), I need to get the revision (git hash or tag) of each repository. Remember that we have one repository for each feature. Manually I could do it but could be very painful. So, with repo you can have one MANIFEST which links to all the revisions of each git repo (one for each feature) and have an specific picture of my whole project.
Simply, I could say that is a way to manage centralized multiple git repositories which are decentralized.
With repo you have more features, not only to checkout at a specific point. For more info go to http://source.android.com/source/using-repo.html.
Repo and git - what they are, what they are for - is explained on source.android.com
To work with the Android code, you
will need to use both Git and Repo.
Git is an open-source version-control system designed to
handle very large projects that are
distributed over multiple
repositories. In the context of
Android, we use Git for local
operations such as local branching,
commits, diffs, and edits.
Repo is a tool that we built on top of Git. Repo helps us manage the
many Git repositories, does the
uploads to our revision control
system, and automates parts of the
Android development workflow. Repo is
not meant to replace Git, only to make
it easier to work with Git in the
context of Android. The repo command
is an executable Python script that
you can put anywhere in your path.
There's no GUI for Repo, as far as I can tell, but there's quite a bit of guidance on the site above for controlling what Repo is doing from the command line.
Concerning the pause and restart point, whilst in a terminal window doing a repo sync you can hit, "ctrl + z" to pause the repo sync. To restart simply type "fg" into the same window.
Go to:
http://source.android.com/source/git-repo.html
and you can download the repo script. It is a Python script that uses the git command to do distributed source code revision.
After you have executed repo sync, do a ps -auwf to see the processes:
For mine I saw:
\_ python -E /sde3/root/download/android/android/.repo/repo/main.py --rep
\_ git fetch korg
\_ git fetch korg
\_ git index-pack --stdin -v --fix-thin --keep=fetch-pack 5227 on
Yes, repo sync breaks often. But it is robust, just restart the command and it will resuming syncing again - those that have been updated will not be re-applied, so it will skip over them and continue with the rest.
repo sync has various useful options:
-f recovers from disconnects
-c just uploads the branch you asked for
-j <#CPUS> speeds up the sync by increasing the number of cpus used by the command