Assumptions
- A remote GIT repository exists
- I want to use the project with Eclipse
- I want a “projects” sub-directory that does not contain Eclipse meta-data
Command Sequence
- mkdir shortname
- cd shortname
- git init
- git remote add shortname url
- git clone url
- git pull -u shortname
- mkdir projects
- cd projects
- mv shortname/ projects/
Open Eclipse and Import Projects!
Reference “Git with Eclipse: Design Patterns”
Case Study: Clone SWTK Commons
- mkdir commons
- cd commons
- git init
- git remote add commons https://github.com/torrances/swtk-common.git
- git clone https://github.com/torrances/swtk-common.git
- Operational Output
-
craigtrim@W540 /c/Backup/Java/workspaces/swtk/commons (master)
$ git clone https://github.com/torrances/swtk-common.git
Cloning into 'swtk-common'...
remote: Counting objects: 737, done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 737 (delta 17), reused 0 (delta 0)
Receiving objects: 100% (737/737), 1.57 MiB | 455.00 KiB/s, done.
Resolving deltas: 100% (237/237), done.
Checking connectivity... done.
- git pull -u commons
- mkdir projects
- cd projects
- mv commons/ projects/
Troubleshooting
- Remote already exists
- The remote add command was already executed
- List existing remotes on the command line using remote -v
- Git Reference: Working with Remotes
- Git Repository Information not displayed in the Eclipse Package Overview
- This is not important. Git interaction should occur within the Git Shell; not within Eclipse. I do not recommend using the built-in Git plugin with Eclipse. Eclipse is useful as an IDE, but building should be handled externally (eg. via Maven) as well as repository interaction (via the Git command line).
Thanks for sharing such a good blog.
ReplyDeleteDevOps Online Training institute
DevOps Online Training in Hyderabad