1 of 29

Tutorial of EGit�

NB commandline git is quite easy, so consider not to use EGit, or to use it in combination ☺

2 of 29

EGit reference

3 of 29

NB Need EGit plugin in Eclipse

*NB: the finding of ‘git’ (2.) may seconds up to minutes, depending on network!

1.

2*.

3.

4 of 29

EGit howto:�Clone repo as Eclipse project

5 of 29

(1) Copy URI of your fork

copy

6 of 29

(2) Go to perspective:� Git Repository Exploring

7 of 29

(4) Right click and ‘Import projects’

8 of 29

(5) Next … Finish

9 of 29

Tip:

Remember the git directory so you can use commandline :-)

10 of 29

EGit how to:�Add blessed as ‘remote’ �for daily sync

Add remotes to pull from other repos

11 of 29

(1) In Git repository view:�Right click remotes and ‘paste’

Or use command:

git remote add blessed

git@github.com:molgenis/molgenis.git

12 of 29

(2) Name your remote

13 of 29

(3) edit (advanced)

1.

2.

14 of 29

Edit -> Add All Branches

15 of 29

(4) Save and fetch

16 of 29

EGit howto

Pull remote

In EGit you need to first 'fetch' and then 'merge' for remotes.

17 of 29

(1a) Fetch upstream, daily!

Choose blessed remote, just click finish

Now all changes are downloaded…

Or use command:

git pull blessed master

18 of 29

(1b) Merge changes, daily

(No additional command needed.... see 1a)

19 of 29

Tip: git staging view

or use command:

git status

20 of 29

(2) Resolve conflicts

2. Edit file(s)

1. See conflicts

3. All solved ☺

4. Commit & push

Conflicts are removed from git index; you need to fix and then re-add the file. Before solved, commits and push is impossible.

21 of 29

(3) Commit changes

Symbols:

? new files that are not in git index (will be ignored, see (3))

+ new files that are not yet commited (aka ‘staged’ ready for push)

> uncommitted changes; these are not yet pushed out to your github repo

* Uncommitted changes; these you will push to your github repo

22 of 29

(3b) commit using ‘synchronize’�usefull for ‘hidden files’ such as .ignore

Symbols:

> there are uncommitted changes

? new files that are not in git index (will be ignored, see (3))

+ new files that are not yet commited (aka ‘staged’ ready for push)

normal arrow: change has been committed but not yet pushed

plus arrow: change has not been committed yet (but + so added to index)

Number of commits

23 of 29

(4) Add new files

? Indicate new files that are not in git index

and will be ignored during commits

+ Indicate new files that are indexed

but not yet commited

NB

  • to add many, you can ‘add index’ on whole directories
  • To undo adding, choose ‘untrack’

24 of 29

(5) Undo changes

25 of 29

(6) Push+pull, end-of-each-day

Review changes

Don’t forget to pull; I have to pull to get rid of ↑1

Or use command:

git push origin master

26 of 29

(7) Pull request�to say that your code is ready for all

27 of 29

Tip: history view

28 of 29

Tip: compare to a remote

Watch out: this is not the way to merge changes because you don’t get the commits

29 of 29

Some links