Introduction to github using Egit
description
Transcript of Introduction to github using Egit
![Page 1: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/1.jpg)
Introduction to Github with Egit
2014/YuMatsuzawa/
![Page 2: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/2.jpg)
Github??
• Google it, now.
• Or, https://github.com/
Introduction to Github 2
![Page 3: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/3.jpg)
Github??
Introduction to Github 3
![Page 4: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/4.jpg)
Github??
Introduction to Github 4
Make your account, now.
![Page 5: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/5.jpg)
Github??
Introduction to Github 5
Make your account, now.
Or, Login if already got one.
![Page 6: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/6.jpg)
You will see…
Introduction to Github 6
![Page 7: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/7.jpg)
You will see…
Introduction to Github 7
…then you are ready.
![Page 8: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/8.jpg)
LOLWATTZDIS?
• With Github, you can…– Find/Clone/Help someone else’s nice projects.– Sync your progress across multiple machines.– Roll back your project to previous state. – Publish/Share your project.
• “Git” is one of many Version Control Systems (VCS).• Github is one of public platforms (hubs) of Git.
Introduction to Github 8
![Page 9: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/9.jpg)
LOLWATSDIS?
• With Github, you can…– Find/Clone/Help someone else’s nice projects.– Sync your progress across multiple machines.– Roll back your project to previous state. – Publish/Share your project.
• “Git” is one of many Version Control Systems (VCS).• Github is one of public platforms (hubs) of Git.
Introduction to Github 9
• Seems nice, but what is ‘cloning’? Cloning a project is basically copying it to
your machine/environment to extend it as you like.
You can clone any public projects including very famous one such as jQuery (/jQuery/jQuery)
• How to help someone? Clone their project, modify, and offer
your help as ‘pull request’ (covered later)
![Page 10: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/10.jpg)
LOLWATSDIS?
• With Github, you can…– Find/Clone/Help someone else’s nice projects.– Sync your progress across multiple machines.– Roll back your project to previous state. – Publish/Share your project.
• “Git” is one of many Version Control Systems (VCS).• Github is one of public platforms (hubs) of Git.
Introduction to Github 10
• Thanks a bunch! But how? Covered later in detail; in a few words:
1. Uploading your progress to Github2. Downloading it to other machines3. (Conflict shall be checked/marked)
• Is it automatic? NO. Why? Covered later.
![Page 11: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/11.jpg)
LOLWATSDIS?
• With Github, you can…– Find/Clone/Help someone else’s nice projects.– Sync your progress across multiple machines.– Roll back your project to previous state. – Publish/Share your project.
• “Git” is one of many Version Control Systems (VCS).• Github is one of public platforms (hubs) of Git.
Introduction to Github 11
• Why this is important? When you mess up with your project and
it stops working (happens often), you can come back to the point it had worked.
• To any states before? Any limit? No limitation. Github doesn’t have “max
space.” You’ll see why.
![Page 12: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/12.jpg)
LOLWATSDIS?
• With Github, you can…– Find/Clone/Help someone else’s nice projects.– Sync your progress across multiple machines.– Roll back your project to previous state. – Publish/Share your project.
• “Git” is one of many Version Control Systems (VCS).• Github is one of public platforms (hubs) of Git.
Introduction to Github 12
• Could be useful… but can I keep it private? NO. This is why github is free AND space-
unlimited. Projects uploaded on github is considered public assets(or Open Source Software) thus forcibly published.
• Really? …Unless you pay at least $7/month.
![Page 13: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/13.jpg)
Now you know Github is
• Platform of distributed development for Open Source Software using Git– Actually, not limited to software. Any contents can
be managed on github (images, .doc, .xls, etc.)– You must acknowledge contents on Github is
published, thus you shouldn’t upload restricted contents (such as data including private info.)
– Let’s delve into “How”
Introduction to Github 13
![Page 14: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/14.jpg)
From Where?
• Basic Git is CUI thing
– You may learn/use Git this way, and actually, sometimes, for some kind of people, it’s even easier. But for now…
• Let’s do this from Eclipse GUI (for Java users)
Introduction to Github 14
![Page 15: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/15.jpg)
Requirement
• Any working Eclipse (not too old one)• ssh-keygen– Included in recent versions of Eclipse– Other ways:
• On Mac/Linux this is innately installed• On Windows:
– If you have cygwin installed, you’re OK.– If you have PuTTY or TeraTerm installed, you’re OK.– Otherwise, install TeraTerm.
» PuTTY and TeraTerm are both terminal emulator. For OpenSSH keygen purpose, TeraTerm is simpler and easier.
Introduction to Github 15
![Page 16: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/16.jpg)
EGit
• … is Eclipse plugin for Git.• Install it.
1. Launch Eclipse2. Help > Eclipse Marketplace3. Search “EGit”4. Install
Introduction to Github 16
![Page 17: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/17.jpg)
Prepare SSH public key
• Stay in Eclipse• Open “ 設定” (Preferences )– “ 一般” (General)>” ネットワーク接続” (Network Connection)>”SSH2”– “ 鍵管理” (Key Management)– “RSA 鍵の生成” (Generate RSA Key)– “ 秘密鍵の保管” (Save Private Key)• Default name would be “id_rsa”• Path should be <user>/.ssh/
Introduction to Github 17
![Page 18: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/18.jpg)
Prepare SSH public key• If you already got one, new key isn’t required– Found “<user>/.ssh/id_rsa.pub” ? => Done.
• On Mac/Linux or Cygwin:– Launch Terminal or Cygwin– Type “ssh-keygen”
• Save/Move your key under <user>/.ssh/
• On TeraTerm:– Cancel “ 新しい接続”– “ 設定” > “SSH 鍵生成”
• Save under <user>/.ssh/
Introduction to Github 18
![Page 19: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/19.jpg)
Prepare SSH public key
• On PuTTY:– Find PuTTYGen in PuTTY install directory– “ 生成” (Generate)– (Move cursor around)– “ 変換” (Convert)
>“OpenSSH 形式”• This is for private key
– Save as appropriate name• Default: <user>/.ssh/id_rsa• No extension needed
Introduction to Github 19
![Page 20: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/20.jpg)
Prepare SSH public key
– Copy this• PuTTYGen generate original format ssh key• OpenSSH format key required• This is for pubic key
– Open text editor– Paste– Save as appropriate name• Default: “id_rsa.pub”
Introduction to Github 20
![Page 21: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/21.jpg)
Register public key
Introduction to Github 21
![Page 22: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/22.jpg)
Register public key
Introduction to Github 22
![Page 23: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/23.jpg)
Register public key
Introduction to Github 23
![Page 24: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/24.jpg)
Register public key
Introduction to Github 24
![Page 25: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/25.jpg)
Register public key
Introduction to Github 25
![Page 26: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/26.jpg)
Register public key
Introduction to Github 26
![Page 27: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/27.jpg)
Register public key
Introduction to Github 27
![Page 28: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/28.jpg)
Register public key
Introduction to Github 28
Paste the content of generated id_rsa.pub here
Appropriate title
![Page 29: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/29.jpg)
Specify SSH private key for Eclipse
• Generated your key via Eclipse? => Done.• If not:– Your key is <user>/.ssh/id_rsa? => Done.– If not:• Open “ 設定”• “ 一般” >” ネットワーク接続” >”SSH2”• “ 秘密鍵の追加” (Add Private Key)• Specify your key name
– Make sure it’s stored under <user>/.ssh/
Introduction to Github 29
![Page 30: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/30.jpg)
Authentication Method
• “ 認証方法” (Authentication Methods)• Uncheck “password”– Only key authentication
• Now everything ready!
Introduction to Github 30
![Page 31: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/31.jpg)
Create Repository
• What’s “repository”?– Storage for Git objects– There must be remote repository on Github AND
local repository on your machine– Concept: Transactions are done between
repositories (specific locations)
Introduction to Github 31
![Page 32: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/32.jpg)
Create Remote Repository
Introduction to Github 32
![Page 33: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/33.jpg)
Create Remote Repository
Introduction to Github 33
![Page 34: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/34.jpg)
Create Remote Repository
Introduction to Github 34
![Page 35: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/35.jpg)
Create Remote Repository
Introduction to Github 35
Appropriate title
Description
Cannot choose Private on unpaid account
Make README
![Page 36: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/36.jpg)
Create Remote Repository
Introduction to Github 36
Done.
![Page 37: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/37.jpg)
Share your existing project
• Open your project• Right click• チーム” Team”• プロジェクトの共用 “ Share the project”• “Git”
Introduction to Github 37
![Page 38: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/38.jpg)
Create Local Repository
Introduction to Github 38
![Page 39: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/39.jpg)
Create Local Repository
• Where to reposit?– Recommended: Distinct, new path dedicated only for
that repository outside of Eclipse workspace• Not the same as the already existing project directory
(usually in Eclipse workspace)• Why? -> Several reasons. Primarily for future use when you
would want to place multiple projects in that repo.• Faster (Git only cares about files inside the repo)
– Easier to understand: Project directory• No need to move files (easier to initialize)• Sometimes slower (Git starts to check files in workspace)
Introduction to Github 39
![Page 40: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/40.jpg)
Create Local Repository
• Where to reposit?– Recommended: Distinct, new path dedicated only for
that repository outside of Eclipse workspace• Not the same as the already existing project directory
(usually in Eclipse workspace)• Why? -> Several reasons. Primarily for future use when you
would want to place multiple projects in that repo.• Faster (Git only cares about files inside the repo)
– Easier to understand/start: Project directory• No need to move files (easier to initialize)• Sometimes slower (Git starts to check files in workspace)
Introduction to Github 40
…If you are certain about 1 project <-> 1 repo philosophy
Go to
![Page 41: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/41.jpg)
Create Local Repository
Introduction to Github 41
![Page 42: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/42.jpg)
Create Local Repository
Introduction to Github 42
![Page 43: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/43.jpg)
Create Local Repository
Introduction to Github 43
![Page 44: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/44.jpg)
Create Local Repository
Introduction to Github 44
Aforementioned recommendation
Ignore warning and create repo
![Page 45: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/45.jpg)
Create Local Repository
• If you are to place your repo outside of Eclipse workspace…
Introduction to Github 45
![Page 46: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/46.jpg)
Create Local Repository
• If you are to place your repo outside of Eclipse workspace…
Introduction to Github 46
Default path would be /<user>/git/After proceeding, project migration to new path will begin.
![Page 47: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/47.jpg)
Introduction to Github 47
Repository Ready
![Page 48: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/48.jpg)
Introduction to Github 48
Repository Ready
Open Git repositories pane.ウィンドウ > ビューの表示 > その他 >チーム
Indicators appeared(‘>’,’?’,’[NO-HEAD]’,…)
![Page 49: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/49.jpg)
A little backtracking
• It’s good time to learn how exactly Git works.
Introduction to Github 49
![Page 50: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/50.jpg)
A little backtracking
• It’s good time to learn how exactly Git works.
Introduction to Github 50
GithubYour Machine
Your Eclipse
![Page 51: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/51.jpg)
A little backtracking
• You’ve created repositories.
Introduction to Github 51
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
![Page 52: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/52.jpg)
A little backtracking
• Obviously, you want to store your project.
• …but making repository is just a first step.
Introduction to Github 52
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
![Page 53: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/53.jpg)
A little backtracking
• Inside repos are indexes (file lists)
• Indexes track what files belong to the repos
Introduction to Github 53
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-…-…-…
Index-…-…-…
![Page 54: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/54.jpg)
A little backtracking
• Inside repos are indexes (file lists)
• Indexes track what files belong to the repos
• You can ‘git add’ to the index
Introduction to Github 54
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
‘git add’!!
Added!
![Page 55: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/55.jpg)
A little backtracking
• Now the local repo knows your files
• But only their existence.• Repo must know if files are
ready to be shared/launched
Introduction to Github 55
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
![Page 56: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/56.jpg)
A little backtracking
• Your next move is to register your progress
• •
Introduction to Github 56
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
![Page 57: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/57.jpg)
A little backtracking
• Your next move is to register your progress.
• ‘git commit’ is the way to go.• Records your current progress
on indexed files to the repo.
Introduction to Github 57
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
‘git commit’!!
![Page 58: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/58.jpg)
A little backtracking
• You commit to a specific “branch”
• Branch = Front-ends of devel. flows (latest commits)
First commit creates ‘master’
Introduction to Github 58
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
masterCreated!
![Page 59: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/59.jpg)
A little backtracking
• If you modify your files and commit again,
•
Introduction to Github 59
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
‘git commit’!!
master
c00
![Page 60: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/60.jpg)
A little backtracking
• If you modify your files and commit again,
• …that records are committed to currently targeted branch (in this case ‘master’). New one becomes branch.
Introduction to Github 60
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01
![Page 61: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/61.jpg)
A little backtracking
• You can make another branch
•
Introduction to Github 61
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
another
![Page 62: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/62.jpg)
A little backtracking
• You can make another branch
• Committing to another branch will separate the flow.
Introduction to Github 62
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
another
![Page 63: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/63.jpg)
A little backtracking
• You can make another branch
• Committing to another branch will separate the flow.
• Also you can merge them.
Introduction to Github 63
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
m00
![Page 64: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/64.jpg)
A little backtracking
• If branches conflict (like edited same file),
•
Introduction to Github 64
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
another
![Page 65: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/65.jpg)
A little backtracking
• If branches conflict (like edited same file),
• …Git notifies conflicting files.
Introduction to Github 65
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
another
![Page 66: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/66.jpg)
A little backtracking
• If branches conflict (like edited same file),
• …Git notifies conflicting files.• Then you must manually fix
conflicts then add again.
Introduction to Github 66
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
another
Fix & ‘git add’!!
![Page 67: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/67.jpg)
A little backtracking
• If branches conflict (like edited same file),
• …Git notifies conflicting files.• Then you must manually fix
conflicts then add again.
Introduction to Github 67
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
master
c00 c01 c02 c03
a01a00
m00
![Page 68: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/68.jpg)
A little backtracking
• Anyway, let’s go committing for now!
• Back to Eclipse…
Introduction to Github 68
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
masterCreated!
![Page 69: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/69.jpg)
Introduction to Github 69
Add/Commit
Indicators appeared(‘>’,’?’,’[NO-HEAD]’,…)
![Page 70: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/70.jpg)
Introduction to Github 70
Add/Commit
These indicator means:> -Uncommitted changes exists? -Not added to the index* -Added but uncommitted (‘staged’)[<branch name>] -Current branch**
**Pointer/cursor to current branch is called ‘HEAD’. ‘NO-HEAD’ means no branch specified.
Indicators appeared(‘>’,’?’,’[NO-HEAD]’,…)
![Page 71: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/71.jpg)
Introduction to Github 71
Add/Commit
• Right click on the project,• “ チーム” (Team),
• You’ll find its contents changed• “ コミット” (Commit)
• (You can do the same thing by right-clicking the repository from the repositories pane.)
![Page 72: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/72.jpg)
Introduction to Github 72
Add/Commit
• (This window can differ from an Eclipse version to another, this is Juno 4.2.2)
• Commit Message is important feature used for explaining what changes are made.• Keep it simple but understandable
• If there are untracked files, you can add them here. (Check this “Show untracked”)
Hit “Commit” if messages/adding files are ready
![Page 73: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/73.jpg)
Add/Commit
• Gratz! Your first LOCAL commit (+ add) is made.
• You notice the ‘>’ indicator disappeared from the project.– This means the local repository
now stored your progress.
Introduction to Github 73
![Page 74: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/74.jpg)
“Remote Control”
• Next step is to interact with the remote repo.
•
Introduction to Github 74
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
masterCreated!
![Page 75: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/75.jpg)
“Remote Control”
• Next step is to interact with the remote repo.
• Remote contents are managed with similar branch system.
• On repo creation, remote ‘master’ was also made.
Introduction to Github 75
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
![Page 76: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/76.jpg)
“Remote Control”
• Now, you need special local branch.
•
Introduction to Github 76
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-… r00
masterc00
master
![Page 77: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/77.jpg)
“Remote Control”
• Now, you need special local branch.
• So-called “remote tracking”• This branch tracks/syncs with
status of remote branch.
Introduction to Github 77
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-… r00
master
r00
origin/master
c00
master
![Page 78: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/78.jpg)
“Remote Control”
• ‘origin’ means it’s your primary remote repo.
• ‘origin/master’ means it syncs with ‘master’ branch on your remote repo.
Introduction to Github 78
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-… r00
master
r00
origin/master
*These are just a common tactics to name a remote tracker. You may name yours as you want.
c00
master
![Page 79: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/79.jpg)
“Remote Control”
• Tracker will ‘git fetch’ the remote contents.
• The first fetch creates the remote tracker.
Introduction to Github 79
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-… r00
master
r00
origin/master Created!‘git fetch’!!
c00
master
![Page 80: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/80.jpg)
“Remote Control”
• Then you merge 2 local branches.
•
Introduction to Github 80
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
![Page 81: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/81.jpg)
“Remote Control”
• Then you merge 2 local branches.
• Now local ‘master’ contains all contents from local & remote.
Introduction to Github 81
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
m00
*In distributed developments, conflicts can happen on this phase.**If you followed this instruction, local ‘master’ contains your local project and initially created README from remote at this moment.
![Page 82: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/82.jpg)
“Remote Control”
• With fetch & merge, local branch is up-to-date
• Normally you do this before starting your work of the day.
• You may just ‘git pull’ here.
Introduction to Github 82
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
m00
*Pull basically means ‘fetch then merge’ combined.
![Page 83: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/83.jpg)
“Remote Control”
• Next move obviously, is going opposite way
•
Introduction to Github 83
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
m00
![Page 84: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/84.jpg)
“Remote Control”
• Next move obviously, is going opposite way
• At this point all tools are set.• ‘git push’ will do the trick.
Introduction to Github 84
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
m00
*Push will commit to the remote tracker, then sync it to the branch on the remote by uploading/overwriting contents.**Again, conflicts can happen here, and your push sometimes ‘rejected’ by the remote. If so, you need to fetch & merge.
r01
‘git push’!!
r01
![Page 85: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/85.jpg)
“Remote Control”
• So, in summary:
• Pull (fetch & merge). Remote tracker created. (Do work.) Push. Done. Let’s do this ->
Introduction to Github 85
Github
Your Eclipse
Remote RepositoryLocal Repository
Your Machine
Index-File1-File2-…
Index-…-…-…
c00
master
r00
master
r00
origin/master
m00
r01r01
![Page 86: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/86.jpg)
Remote Configuration
Introduction to Github 86
Back to Web Browsers.Your Remote Repo page.
![Page 87: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/87.jpg)
Remote Configuration
Introduction to Github 87
Back to Web Browsers.Your Remote Repo page.
Copy this address.Make sure its ‘SSH’.
*You registered SSH key, so you can pull/push via SSH connection.**You can pull via HTTPS, but cannot push.
![Page 88: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/88.jpg)
Remote Configuration
Introduction to Github 88
![Page 89: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/89.jpg)
Remote Configuration
Introduction to Github 89
In the Repo Pane, under the repo> “ リモート” (Remote)
![Page 90: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/90.jpg)
Remote Configuration
Introduction to Github 90
Right click> “ リモートの作成” (Create a remote)
In the Repo Pane, under the repo> “ リモート” (Remote)
![Page 91: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/91.jpg)
Remote Configuration
• Making push configuration first would be a little easier.
Introduction to Github 91
![Page 92: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/92.jpg)
Push Configuration
Introduction to Github 92
Click this to expand
![Page 93: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/93.jpg)
Push Configuration
Introduction to Github 93
![Page 94: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/94.jpg)
PushConfiguration
Introduction to Github 94
Your copied address should automatically be inserted from clipboard.
No need to modify username/password.‘git’ is global username, auth’ed by key
![Page 95: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/95.jpg)
Push Configuration
Introduction to Github 95
![Page 96: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/96.jpg)
Push Configuration
Introduction to Github 96
What was HEAD? > Reference to current branch.
Click & focus here, then hit Ctrl+Space
![Page 97: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/97.jpg)
Push Configuration
Introduction to Github 97
Complement service will automatically search existing remote branches.Choose ‘master’ branch.
![Page 98: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/98.jpg)
Push Configuration
Introduction to Github 98
Checking this has literal meaning.When pushing, it will ignore push rejection from the remote branch and forcibly push the local HEAD.Generally a bad idea.
![Page 99: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/99.jpg)
Push Configuration
Introduction to Github 99
![Page 100: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/100.jpg)
Push Configuration
Introduction to Github 100
• Repositories Pane should now be like this.
![Page 101: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/101.jpg)
Push Configuration
Introduction to Github 101
• Repositories Pane should now be like this.• Right click on ‘origin’• “ フェッチの構成” (Configure fetch)
![Page 102: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/102.jpg)
Fetch Configuration
Introduction to Github 102
![Page 103: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/103.jpg)
Fetch Configuration
Introduction to Github 103
Exactly the same as push
![Page 104: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/104.jpg)
Fetch Configuration
Introduction to Github 104
![Page 105: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/105.jpg)
Fetch Configuration
Introduction to Github 105
Again, click & focus here, then hit Ctrl+Space.Choose ‘master’.
![Page 106: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/106.jpg)
Fetch Configuration
Introduction to Github 106
Another overwrite option.Better not check.
![Page 107: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/107.jpg)
Fetch Configuration
Introduction to Github 107
Now that fetch configuration is ready, let’s try fetching for the first time!Remember, first fetch will create the remote tracking branch ‘origin/master’
![Page 108: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/108.jpg)
Fetch
Introduction to Github 108
Result should be like this.
Server certification acceptance may be prompted.
![Page 109: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/109.jpg)
Remote Tracking Branch
• Under “ ブランチ” (Branch)>” リモート・トラッキング” (Remote tracking), you will find ‘origin/master’
• To reflect the remote status to local…
Introduction to Github 109
![Page 110: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/110.jpg)
Merge
• Right click on the remote tracker• “ マージ” (Merge)
Introduction to Github 110
![Page 111: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/111.jpg)
Merge
• At this time, result should be like this.• Key is ‘Fast-forward’(FF)– Basically means no conflicts there.– To be precise, one branch is wholly older, and its
recent commit is included in the other.
Introduction to Github 111
![Page 112: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/112.jpg)
Merge
• Here comes README from the remote joining the local.
• Finally, to upload this merged commit to the remote…
Introduction to Github 112
![Page 113: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/113.jpg)
Push
Introduction to Github 113
2 ways of doing this:
Right click on the project> “ チーム” (Team)>” アップストリームへプッシュ” (Push to upstream)
orRight click on ‘origin’ under “ リモート”>” プッシュ” (Push)
![Page 114: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/114.jpg)
Push
Introduction to Github 114
• Result should be like this.• At this time no rejection for sure.
![Page 115: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/115.jpg)
Check on Github
Introduction to Github 115
Back to Web Browsers.Try refresh.
![Page 116: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/116.jpg)
Check on Github
Introduction to Github 116
Happy face
![Page 117: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/117.jpg)
Easier way for daily use
• Now the very basic git usage is covered.• May pull / commit and push as shortcut.
Introduction to Github 117
![Page 118: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/118.jpg)
Versioning
• Versioning is done through tagging in git.• You may noticed “ タグ” (Tag) in the repo
pane.• Right click and “ タグの作成” (Create a tag)
Introduction to Github 118
![Page 119: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/119.jpg)
Tag
Introduction to Github 119
Hit this to expand
![Page 120: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/120.jpg)
Tag
Introduction to Github 120
Appropriate name (such as v1.0, v2.4-beta)
Description message
Choose a commit you want to tag
![Page 121: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/121.jpg)
Tag
• Now that commits are tagged.• If you want to publish these tags (versions),
you need to push tags manually.– Not tied to branch pushing, but the concept is
exactly the same.
Introduction to Github 121
![Page 122: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/122.jpg)
Push Tag
• Right click on the tag > “Push Tag”• “ 構成済みレポジトリー”
(Configured Repository)• Hit Next
Introduction to Github 122
![Page 123: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/123.jpg)
Push Tag
• Tricky part: Tags are referred like ‘refs/tags/<tag name>’.
Introduction to Github 123
![Page 124: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/124.jpg)
Push Tag
• Tricky part: Tags are referred like ‘refs/tags/<tag name>’.
• You need to manually specify this.
Introduction to Github 124
Target name
![Page 125: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/125.jpg)
Push Tag
• Tricky part: Tags are referred like ‘refs/tags/<tag name>’.
• You need to manually specify this.
• Basically just copy the name above.
Introduction to Github 125
Target name (refs/tags/v1.1)
![Page 126: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/126.jpg)
Push Tag
• Result should be like the left• On Github, ‘releases’ should appear and you
can see the version history
Introduction to Github 126
![Page 127: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/127.jpg)
Versioning
• Versioning itself needs its own philosophy and practice, and it’s ultimately depends on how the team will handle the project.
• Make/follow the guideline and decide when/how often/what kind of state to publish.
Introduction to Github 127
![Page 128: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/128.jpg)
From Remote, Comes…
• So far, we assumed you have your local project developed without using git.
• And how to integrate it with git is covered.
• Let’s see how to duplicate your git-integrated project to your extra machines.
• Or to duplicate other’s project.– These are done with exact same procedure.
Introduction to Github 128
![Page 129: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/129.jpg)
Clone
• You can ‘git clone’ the remote repo itself.
•
Introduction to Github 129
Github
Your Eclipse
Remote Repository
Your MachineIndex-…-…-… r00
master
r01
![Page 130: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/130.jpg)
Clone
• You can ‘git clone’ the remote repo itself.
• And it’s really easy!• Not only it copies contents of
the repo, it automatically set all the remote configuration!
Introduction to Github 130
Github
Your Eclipse
Remote Repository
Your MachineIndex-…-…-… r00
master
r01
Local Repository
Index-File1-File2-…
c00
master
r00
origin/master
m00
r01
‘git clone’!!Created!
Created!
Created!
Created!
![Page 131: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/131.jpg)
Clone
• All you need is…
• Copy.
Introduction to Github 131
This.
![Page 132: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/132.jpg)
Clone
• On your target machine,• Right click on the blank area of the repo pane.• “ リポジトリー・パスまたは URI の貼り付け”
Introduction to Github 132
![Page 133: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/133.jpg)
Clone
Introduction to Github 133
Same as before.
![Page 134: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/134.jpg)
Clone
Introduction to Github 134
You cannot clone to non-empty path.
If the repo includes Java project, you can also import them.
![Page 135: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/135.jpg)
Clone
• With cloning, you can duplicate your Eclipse project env. on another machine with ease.– As long as you respect the procedure of
pull/modify/commit/push, you can work on your project from various places without an issue.
– But sometimes an error will happen. And in a team development conflicts are common.• To prevent your working branch being overwritten by a
problematic commit, there is no auto-pull.• To prevent not-ready code being sent to the remote, there is
no auto-commit/push.
Introduction to Github 135
![Page 136: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/136.jpg)
Clone/Fork
• You can clone other developer’s repository, and modify on branches as you like.– You may do this on Github alone, creating the remote
clone of the original in your account. (Called forking.)– Note: However, pushing to original repository is only
allowed to the repo’s owners.• If you have done valuable modification to the branch of
cloned/forked repo, you can ‘pull request’ to the owner.• Push your branch to forked repo, then submit pull request
on the original repo.
Introduction to Github 136
![Page 137: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/137.jpg)
.gitignore
• Sometimes you want certain files to stay untracked/excluded from index.– Especially data including privacy info.
• Then you can “ 無視” (ignore) such data.– Listed on .gitignore
• After that, commit thebranch– .gitignore will be added
Introduction to Github 137
![Page 138: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/138.jpg)
Back to the Past
• So how to return to previous state?• 1-step back (just want to discard 1 commit):– Already pushed? > git revert. Making new commit.
• But your code may already be used by someone.– Not pushed? > Amend commit, or reset and start over.
• Multi-step back– Make new branch on the past commit, checkout (means
moving your current branch(HEAD)), work on it, eventually merge with master, or discard old master and name the current as new master.
– Branching is has high flexibility.
Introduction to Github 138
![Page 139: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/139.jpg)
Other stuff
• There are many more functions in git– Notably rebase.
• But for now, that’s it!– For personal/laboratory use, we learned more
than enough I believe.
• Utilize my account(/YuMatsuzawa/) for testing
Introduction to Github 139
![Page 140: Introduction to github using Egit](https://reader033.fdocuments.net/reader033/viewer/2022061103/53fe9db38d7f726a5c8b4570/html5/thumbnails/140.jpg)
CUI (Git for Windows required)
• $ cd <project directory>• $ git init #repo created• $ git add <files to be added>• $ git commit –a #commit all• $ git remote add origin <remote URI>
#remote config• $ git fetch origin #fetch any branches• $ git merge origin/master #merge remote tracker• $ git push origin master #push to remote
Introduction to Github 140