SlideShare a Scribd company logo
Git & GitHub
12/30(Wed) Hypercomputer Seminar
Taehwan Kim
maxtortime@gmail.com
http://fast.ajou.ac.kr
DVCS ? CVCS ?
• Git based on DVCS
(Distributed Version
Control System).
• DVCS just mirrors full
repositories, unlike
CVCS.
• CVCS (Central Version
Control System) only
checkouts file’s final
snapshot.
Why should you use Git?
• If you use a SVN, you will lose all history when main server is
damaged. You can recover only your final snapshot.
• But If you use a Git, recovering is very easy because you just
choose one of the repositories. (think previous slide’s image)
• DVCS environment can have multiple remote repositories,
so you can work together various group and people.
Snapshots, Not Differences
Git don’t save difference of file, just take a picture of
file at that moment. Git thinks about its data more
like a stream of snapshots.
Git has the three states.
1. ‘Committed’ means that the data saved safely on the
repo.
2. ‘Modified’ means that you have changed the file but
have not committed it to your repo.
3. ‘Staged’ means that you have marked a modified file
in its current version to go into your next commit
snapshot.
Diagram of Git states.
Files in your working directory
• Tracked: Already contains in snapshot. (above three
states, committed, (un)modified, staged.
• Untracked: Your files don’t contain snapshot or
staging area.
Git: GUI vs CLI ??
• Today’s seminar’s goal is becoming skillful for using
Git in terminal environment.
• The command line(CLI) is the only place you can
run all Git commands.
USING GIT WELL IN
GUI ENVIRONMENT
USING GIT WELL IN
TERMINAL
ENVIRONMENT
CAN
CANNOT
$ git clone
1. Using HTTPS
$ git clone https://github.com/username/foo.git
2. Using SSH
$ git clone git@github.com:username/foo.git
1. Clone repo. Using HTTPS
• Authentication with username and password.
• You don’t have to set anything.
• But you should type username and password every
time when push, pull, fetch.
• You can use a credential storage but I think that its
setting is more complex than SSH.
2. Clone repo. Using SSH
• Auth. and send data using SSH protocol.
• Most of operating systems have SSH daemon and
management tools. So, setting is very easy.
• But, you should register public key to git hosting
server EACH DEVICES.
• From my experience, I think that register key is
better than remembering password.
How to generate SSH keys.
• First, you should generate your public SSH key.
$ ssh-keygen
• Many options for making key, but Now, we just
become YESMAN. (more information)
• Copy your public key to clipboard. Your key files is
in ~/.ssh/id_rsa.pub
• Turn on your Internet Browser and go to
http://github.com
Register public key to GitHub
Remote repository ?
• After clone project. Your local git repo has ‘origin’
remote repo.
• How to check remote repo?
$ git remote –v # show URL and remote name
• You can add more remote repo.
$ git remote add <name> <URL>
• Therefore, you can use multiple protocol using
above commands.
• More information
Checkout? Remote Branch?
• After clone repo, your current branch is ‘master’
and there is no local branch.
• But you want to work at ‘foo’ branch which your
co-worker worked before.
• How to move that branch?
$ git checkout origin/foo –b foo
• origin/foo is a remote branch of origin (remote
repo) and foo is your local branch.
$ git checkout
• You can move branch and restore something.
• In other words, ‘git checkout origin/foo’ means
now you want to move to origin/foo branch.
• ‘-b’ option means making new branch while moving.
• Q. Why not just type ‘git checkout –b origin/foo’?
• If your working directory is dirty, you should
arrange your directory. (more info..)
• If you change branch using checkout, your working
directory will be changed.
$ git branch
• If you just want to make a new branch.
$ git branch testing
# foo1 also directs current working branch.
• How to determine current working branch?
Git has a pointer ‘HEAD’.
$ git log
• git log show commit histories.
• -2 , n : show only 2 .. n histories.
• --oneline : show each log one line.
• --decorators : show connected branch.
• --grep <string> : show histories contain <string>
• … many options.
Git and GitHub
What is a branch?
• Git branch is just SHA-1 checksum files direct to
some commit.
• So, it is very easy to make or delete branch.
• Each branches save previous commit’s information.
• Therefore, developers make and delete branch
often.
Fast-Forward merge.
When A merge to B, If B directs the commit which
after A, just A directs B’s commit.
3-Way merge.
• When current branch’s commit is not ancestor of
target branch’s commit.
• 3-Way merge occurs CONFILCT when two branch
modify same part of one file.
How to check CONFILCTS
• After commit failed, you can know conflicted file.
$ git merge iss53
Auto-merging index.html
CONFILCT (content) : Merge conflict in index.html
Automatic merge failed; fix conflicts and then
commit the result.
• You also check unmerged file by ‘$ git status’
commands
How to resolve CONFILCTS
First, open unmerged file by text editor.
HEAD means your current branch and below of
=====.. means your target branch. You just choose
contents each branches or write new contents.
Fetch vs Pull
• Fetch just sync with remote repo.
• Pull merges remote branch and download data
from remote repo at the same time.
(fetch + merge)
• Example
$ git fetch origin
# Just download data from remote repo.
$ git pull origin master
# Merge origin/master to master
Thank you for listening!
Read https://git-scm.com/book/ko/v2 and keep studying!

More Related Content

PDF
Stress Free Deployment - Confoo 2011
ODP
Source Code Management systems
PDF
Writing a fast HTTP parser
KEY
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
PDF
Woo: Writing a fast web server @ ELS2015
KEY
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
PPTX
Broccoli.js presentation
PPTX
London Community Summit - Habitat 2016
Stress Free Deployment - Confoo 2011
Source Code Management systems
Writing a fast HTTP parser
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Woo: Writing a fast web server @ ELS2015
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Broccoli.js presentation
London Community Summit - Habitat 2016

What's hot (20)

PDF
Ansible Oxford - Cows & Containers
PDF
Source Code Management with Git
ODP
Developing high-performance network servers in Lisp
PDF
Deploying PHP Applications with Ansible
PDF
Quick Introduction to git
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
PPTX
Mongo db - How we use Go and MongoDB by Sam Helman
PPTX
Introduction to bower
PDF
Developing Java based microservices ready for the world of containers
PDF
Docker up and running
PDF
Distributed Developer Workflows using Git
PDF
Phoenix for Rails Devs
PPT
PDF
Introducing Wordpress Multitenancy
PDF
Built in ci-cd with kubernetes, jenkins and helm
PPTX
Git learn from scratch
PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
PPTX
Ansible presentation
PDF
Developing Java based microservices ready for the world of containers
PDF
Build in continuous integration, delivery and deploy
Ansible Oxford - Cows & Containers
Source Code Management with Git
Developing high-performance network servers in Lisp
Deploying PHP Applications with Ansible
Quick Introduction to git
Ansible: How to Get More Sleep and Require Less Coffee
Mongo db - How we use Go and MongoDB by Sam Helman
Introduction to bower
Developing Java based microservices ready for the world of containers
Docker up and running
Distributed Developer Workflows using Git
Phoenix for Rails Devs
Introducing Wordpress Multitenancy
Built in ci-cd with kubernetes, jenkins and helm
Git learn from scratch
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Ansible presentation
Developing Java based microservices ready for the world of containers
Build in continuous integration, delivery and deploy
Ad

Viewers also liked (15)

PDF
Presentation2
PDF
C Jagdishan - Smart Cities Citizen Engagement
PDF
How do you eat an elephant
PDF
Group 5 Revised Country Profile
KEY
ser324gjhgt14314hkl
PDF
PDF
PPTX
Unsur unsur transisi kelompok 4 SMK-SMAK Bogor
PPTX
Shah medium of instruction
PPTX
Unsur periode 3
PDF
Seminario didático de pesquisa - Mestrado
PDF
Seminário didático - Doutorado
PPT
Performance Management & Strategic Planning {Lecture Notes}
PPTX
Kimia unsur ppt
PDF
rapport_2012-1
Presentation2
C Jagdishan - Smart Cities Citizen Engagement
How do you eat an elephant
Group 5 Revised Country Profile
ser324gjhgt14314hkl
Unsur unsur transisi kelompok 4 SMK-SMAK Bogor
Shah medium of instruction
Unsur periode 3
Seminario didático de pesquisa - Mestrado
Seminário didático - Doutorado
Performance Management & Strategic Planning {Lecture Notes}
Kimia unsur ppt
rapport_2012-1
Ad

Similar to Git and GitHub (20)

PPTX
Understanding about git
PPT
Fundamentals and basics of Git and commands
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
PDF
Git slides
PDF
Git of every day
PDF
Formation git
PDF
git- Most Of The Things About a Trending DVCS
PDF
Introduction to Git
PDF
Git Init (Introduction to Git)
PDF
Version Control System - Git
PPTX
Git and GitHub
PDF
Git basic and workflow
PPTX
Getting with GIT
PPTX
git github PPT_GDSCIIITK.pptx
PDF
git-commands-cheat-sheet-infopediya-com.pdf
PPTX
Getting Git...before it gets you
PPTX
An introduction to Git
PDF
Git Developer Cheatsheet
PDF
SVN 2 Git
PPTX
Introduction to git hub
Understanding about git
Fundamentals and basics of Git and commands
Let's Git this Party Started: An Introduction to Git and GitHub
Git slides
Git of every day
Formation git
git- Most Of The Things About a Trending DVCS
Introduction to Git
Git Init (Introduction to Git)
Version Control System - Git
Git and GitHub
Git basic and workflow
Getting with GIT
git github PPT_GDSCIIITK.pptx
git-commands-cheat-sheet-infopediya-com.pdf
Getting Git...before it gets you
An introduction to Git
Git Developer Cheatsheet
SVN 2 Git
Introduction to git hub

Recently uploaded (20)

PPTX
UNIT 4 Total Quality Management .pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Artificial Intelligence
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
737-MAX_SRG.pdf student reference guides
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
composite construction of structures.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Well-logging-methods_new................
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
III.4.1.2_The_Space_Environment.p pdffdf
UNIT 4 Total Quality Management .pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Artificial Intelligence
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
CH1 Production IntroductoryConcepts.pptx
Geodesy 1.pptx...............................................
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Embodied AI: Ushering in the Next Era of Intelligent Systems
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
737-MAX_SRG.pdf student reference guides
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Safety Seminar civil to be ensured for safe working.
R24 SURVEYING LAB MANUAL for civil enggi
composite construction of structures.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Well-logging-methods_new................
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
III.4.1.2_The_Space_Environment.p pdffdf

Git and GitHub

  • 1. Git & GitHub 12/30(Wed) Hypercomputer Seminar Taehwan Kim maxtortime@gmail.com http://fast.ajou.ac.kr
  • 2. DVCS ? CVCS ? • Git based on DVCS (Distributed Version Control System). • DVCS just mirrors full repositories, unlike CVCS. • CVCS (Central Version Control System) only checkouts file’s final snapshot.
  • 3. Why should you use Git? • If you use a SVN, you will lose all history when main server is damaged. You can recover only your final snapshot. • But If you use a Git, recovering is very easy because you just choose one of the repositories. (think previous slide’s image) • DVCS environment can have multiple remote repositories, so you can work together various group and people.
  • 4. Snapshots, Not Differences Git don’t save difference of file, just take a picture of file at that moment. Git thinks about its data more like a stream of snapshots.
  • 5. Git has the three states. 1. ‘Committed’ means that the data saved safely on the repo. 2. ‘Modified’ means that you have changed the file but have not committed it to your repo. 3. ‘Staged’ means that you have marked a modified file in its current version to go into your next commit snapshot.
  • 6. Diagram of Git states.
  • 7. Files in your working directory • Tracked: Already contains in snapshot. (above three states, committed, (un)modified, staged. • Untracked: Your files don’t contain snapshot or staging area.
  • 8. Git: GUI vs CLI ?? • Today’s seminar’s goal is becoming skillful for using Git in terminal environment. • The command line(CLI) is the only place you can run all Git commands. USING GIT WELL IN GUI ENVIRONMENT USING GIT WELL IN TERMINAL ENVIRONMENT CAN CANNOT
  • 9. $ git clone 1. Using HTTPS $ git clone https://github.com/username/foo.git 2. Using SSH $ git clone git@github.com:username/foo.git
  • 10. 1. Clone repo. Using HTTPS • Authentication with username and password. • You don’t have to set anything. • But you should type username and password every time when push, pull, fetch. • You can use a credential storage but I think that its setting is more complex than SSH.
  • 11. 2. Clone repo. Using SSH • Auth. and send data using SSH protocol. • Most of operating systems have SSH daemon and management tools. So, setting is very easy. • But, you should register public key to git hosting server EACH DEVICES. • From my experience, I think that register key is better than remembering password.
  • 12. How to generate SSH keys. • First, you should generate your public SSH key. $ ssh-keygen • Many options for making key, but Now, we just become YESMAN. (more information) • Copy your public key to clipboard. Your key files is in ~/.ssh/id_rsa.pub • Turn on your Internet Browser and go to http://github.com
  • 13. Register public key to GitHub
  • 14. Remote repository ? • After clone project. Your local git repo has ‘origin’ remote repo. • How to check remote repo? $ git remote –v # show URL and remote name • You can add more remote repo. $ git remote add <name> <URL> • Therefore, you can use multiple protocol using above commands. • More information
  • 15. Checkout? Remote Branch? • After clone repo, your current branch is ‘master’ and there is no local branch. • But you want to work at ‘foo’ branch which your co-worker worked before. • How to move that branch? $ git checkout origin/foo –b foo • origin/foo is a remote branch of origin (remote repo) and foo is your local branch.
  • 16. $ git checkout • You can move branch and restore something. • In other words, ‘git checkout origin/foo’ means now you want to move to origin/foo branch. • ‘-b’ option means making new branch while moving. • Q. Why not just type ‘git checkout –b origin/foo’? • If your working directory is dirty, you should arrange your directory. (more info..) • If you change branch using checkout, your working directory will be changed.
  • 17. $ git branch • If you just want to make a new branch. $ git branch testing # foo1 also directs current working branch. • How to determine current working branch? Git has a pointer ‘HEAD’.
  • 18. $ git log • git log show commit histories. • -2 , n : show only 2 .. n histories. • --oneline : show each log one line. • --decorators : show connected branch. • --grep <string> : show histories contain <string> • … many options.
  • 20. What is a branch? • Git branch is just SHA-1 checksum files direct to some commit. • So, it is very easy to make or delete branch. • Each branches save previous commit’s information. • Therefore, developers make and delete branch often.
  • 21. Fast-Forward merge. When A merge to B, If B directs the commit which after A, just A directs B’s commit.
  • 22. 3-Way merge. • When current branch’s commit is not ancestor of target branch’s commit. • 3-Way merge occurs CONFILCT when two branch modify same part of one file.
  • 23. How to check CONFILCTS • After commit failed, you can know conflicted file. $ git merge iss53 Auto-merging index.html CONFILCT (content) : Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. • You also check unmerged file by ‘$ git status’ commands
  • 24. How to resolve CONFILCTS First, open unmerged file by text editor. HEAD means your current branch and below of =====.. means your target branch. You just choose contents each branches or write new contents.
  • 25. Fetch vs Pull • Fetch just sync with remote repo. • Pull merges remote branch and download data from remote repo at the same time. (fetch + merge) • Example $ git fetch origin # Just download data from remote repo. $ git pull origin master # Merge origin/master to master
  • 26. Thank you for listening! Read https://git-scm.com/book/ko/v2 and keep studying!

Editor's Notes

  • #9: Windows 에서 git bash 를 쓰는 법을 알려줄 것
  • #14: 같이 해보기
  • #15: 여기서 왜 여러 프로토콜을 사용할 수 있는지 알려주기
  • #17: 왜 그냥 –b origin/foo 하면 안 되는지 설명