Until now I was using Eclipse + SVN with the typical project App + project libraries.
I use a single SVN repository using the following structure:
root
-Apps
-App1
-trunk
-tags
-branches
-Libs
-Lib1
-trunk
-tags
-branches
-Lib2
-trunk
-tags
-branches
I ported the project to Android Studio and I'm trying to do store the modules in a Git repo. I'm starting with Git and I don't achieve it, it seems like git is prepared to have one project per repository, isn't it? How can I solve that?
Thanks
Git is ready for that, just use git submodules. Separate your projects in different repositories and then link them together as submodules, let me point you to a guide:
http://git-scm.com/book/en/v2/Git-Tools-Submodules
So for example, if you are in your project A and want to add project B, do:
git submodule add https://github.com/myrepo/B
And then do:
$ git submodule init
$ git submodule update
Related
I want to create a new Maven project in Eclipse and push it to a new repository on github. I am a bit stuck on the right order of steps to achieve this.
To use a Maven archetype, I cannot use a directory with files in it. So I cannot create a Maven project in a git local repository. So using the archetype should probably come first.
I also need to create a repository in my github account. If I do this through the github desktop app, this already creates a local repository for me.
Now I have an Eclipse project and a local repository, up to now unrelated. How should I "relate" them?
I found a lot of information about cloning from github, but my github repository does not have a Maven project yet, so I cannot import in Eclipse. If I use command line instead and an empty directory, I cannot apply Maven archetypes any more because the directory is not empty.
I am confused. Can somebody de-confuse me?
Create a new Maven project (however you want to create it). This, of course, will create a new directory in the file system with all the resources.
Create a repository in Github.
From the command line (located inside the project directory) do git init. This will create the local repository inside that directory.
Next, add a remote to your local repository: $ git remote add origin https://github.com/user/repo.git (optionally replace origin for the name your remote repository is going to be called, also replace user for your github username and repo for the name of your github repository name)
Add all files to be commited in the local repository.
For example
$ git add .
# Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
Commit changes.
For example:
$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
Push to remote.
Just be clear, taking the following structure as reference, What I propose is to have as git repositories any of the directories project1, project2, projectN, not the whole worspace (/roo_dir/workspace/ directory).
/roo_dir/workspace/
- project1
- project2
- projectN
Additional readings:
Considerations for Git Repositories to be used in Eclipse
Should I store git repository in Home or Eclipse Workspace?
Is it better to keep Git repository inside or outside of Eclipse workspace?
Try this
Create a blank project in git hub
create a maven project in local
clone the git repo
this will not have any file
copy the maven project
add the files to git and push
Finally, I did the following:
I created a new Maven project with an archetype in the directory for github local repositories.
I used the github app to create repository with the same name in the same directory.
Then I published this repository to github.
Now I imported the project from the github local repository to eclipse.
The workflow is generally the one suggested by #lealceldeiro, but without using the command line git.
I am a beginner in maven
so, I am trying to create maven depend on progect in github
I git this project https://github.com/jenshuesken/incubator-olingo-odata4
I need to use ODataJClient, I am trying to git clone and import it in eclipse
but nothing come, please see figure 1
figure 1
I need to use engin in ODataJClient
AM waiting
The right step is build all modules in eclipse,then push it to github. A parent pom includes all modules information. After this,you can git clone it correctly.
I am using eclipse BndTools with a few dedicated workspaces each stored in a single git repo and I've been quite happy sofar.
I've been sharing projects between workspaces by copying them. But recently decided to pull common code into a shared code git repository. In eclipse this is trivial, just use subfolders in your workspace, one per repository.
However to my surprise bndtools demands that I place one cnf project next to my projects in the filebase. At the same time I can only have one cnf project in my workspace. Which effectively means ALL my projects should be peers.
Which in turn means I cannot use multiple git repositories as they cannot share the same directory. Unless I split each project into it's own repository and with 50+ projects this is clearly not where I want to go.
I know eclipse can do this, but is there a way to get bndtools to play ball?
Which effectively means ALL my projects should be peers.
...
Which in turn means I cannot use multiple git repositories as they cannot share the same directory. Unless I split each project into it's own repository
This is where submodule is coming for rescue.
Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.
How to use submodules
# Create each project in its own repository
# now add the desired submodule to your project
git submodule add <url>
# now init/update one by one or recursively all at once
git submodule init
git submodule update
I am developing a project in java, using eclipse, making backup by git (Bitbucket), and I decided to use build it using gradle.
Some of my source code can be used by other project, so I want to move them to other project and manage with another git repository. I want to add them as a dependency to the original project. What should I have to write in build.gradle?
Here are the docs you need. Basically you need to create a standalone gradle project from the separate part. And then with the usage of settings.gradle create a multi project build. Maybe git modules will be also useful.
An Android Java project placed in a git repository and built in an Android tree in /packages/apps needs to have the project files located at the root of the git repository.
This is problematic for creating a complementary Test project, which should ideally be included in the same git repository so commits are atomic for both code and tests. Eclipse gets very unhappy if you include the Test project as a subdirectory.
Is there an appropriate approach for dealing with this other than creating a second repository?
I dont know git but this seems to be a code organization problem rather than git issue. I think I would create a workspace and then have the application and test project as sub projects within that workspace, like this
/packages/apps/<product-name> - This is the workspace
/packages/apps/<product-name>/app-name - This is the application
/packages/apps/<product-name>/app-name-test - This is the test project for the application
I don't use git inside eclipse. I have my repo cloned at ~/work/repo and have 2 subfolders one for the actual project and one for the test project. Then inside my workspace i have 2 symlinks that point to the folders inside the repo folder. Eclipse thinks they are both normal projects and doesn't care about the repo management. I just go to command line and "cd ~/work/repo; git add .; git commit; " and i can commit both test and code at the same time.
Hope that helps