Code44free's Blog

Use Eclipse and git without pain

Posted in Eclipse, Git, programming by code44free on Октябрь 27, 2014

Notes for using Git repository with Eclipse IDE.

1. Register account on https://bitbucket.org/ Main advantages: the ability to create unlimited number private repositories for free. Plus simple and intuitive web-interface.

2. Create repository

bitbucket.org

3. In Eclipse open from system menu «window -> show view -> other -> git -> git repositories»

eclipse_git_3

4. Create local repository. In the «repository directory» parameter set the project directory. In result all project stuff: project files and git files will be stored in the one directory.

eclipse_git_4

5. In created repository right-click and from context menu select «Remotes -> Create remote»

eclipse_git_5

6. Copy repository link from https://bitbucket.org/ site to system clipboard

eclipse_git_2

7. and in the next window press «Change» button.

eclipse_git_6

8. In next, enter password from https://bitbucket.org/ account. In properties window enter git settings and press «Finish» button in that window and «Save» in next.

eclipse_git_7

9. As result in «Remotes» will created two resources for git fetch and push.

eclipse_git_8

10. Go to site https://www.gitignore.io/ enter «android eclipse java» and push «Generate». Save the resulting text in a new file with name .gitignore in the project directory. At the end of the file further add:

.classpath
.gitignore
.project

11. In Eclipse in project tree choose folders src/, assets/, res/, and files that need to get to the repository. Right-click on chosen files to call shortcut menu and select «Team -> Add to index».

eclipse_git_9

12. Right-click on project and from shortcut menu choose «Team -> Commit». Mark files, write commit comment and press button «Commit and push -> Next -> Commit»

eclipse_git_10

eclipse_git_11

13. In Git view call shortcut menu by right-click on «Remotes -> Origin -> Push (icon with red arrow) -> Configure push». In new window press Advanced button (right bottom).

14. In new window set the following settings

source ref: HEAD
Destination ref: HEAD
Add All Branches Spec
Add All Tags Spec

Press «Finish» in that window and «Save» in previous.

eclipse_git_12

15. Now, after making changes in project files select «Team -> Commit», enter commit comment and press «Commit and Push» button. For viewing the commits history, commit revert and other actions, in the context menu select «Team -> Show in history».

eclipse_git_13

Реклама
Tagged with: ,

Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:

Логотип WordPress.com

Для комментария используется ваша учётная запись WordPress.com. Выход / Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход / Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход / Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход / Изменить )

Connecting to %s

%d такие блоггеры, как: