git
TRANSCRIPT
![Page 1: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/1.jpg)
Distributed version control system
![Page 2: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/2.jpg)
Agenda
Introduction to GIT
Working with GIT
GIT under the hood
Questions?
![Page 3: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/3.jpg)
Introduction to GIT
![Page 4: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/4.jpg)
Why use GIT?
Distributed
No single point of failure
Fast
Easy branching and merging
Data integrity
![Page 5: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/5.jpg)
GIT usage
Source : Eclipse Community Survey
![Page 6: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/6.jpg)
Staging Area
![Page 7: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/7.jpg)
Any Workflow
![Page 8: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/8.jpg)
Integrity
When you run "git add filename" a copy of the file is placed in the repository with a key that is SHA-1 hash of the file
This way Git can always validate the integrity of the files it return
The same is true for others objects stored in Git like commits
![Page 9: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/9.jpg)
BitbucketCloud hosted GIT and Mercurial
Competitor of GitHub but with free private repositories
Free account provides unlimited private repositories for up to 5 users
Wiki and issues tracking are also included
Web interface exposes GIT commands and enables to browse the cource code
![Page 10: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/10.jpg)
SourceTree and IDE
Free GIT and Mercurial client
Works on both Windows and Mac
Enable to use of most GIT commands from a GUI
Most IDE (Eclipse, IntelliJ, etc...) also support GIT
![Page 11: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/11.jpg)
Working with GIT
![Page 12: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/12.jpg)
Create a repository
Initializing a repository in an existing directory
Cloning an existing repository
The git repository will be created in a hidden subdirectory called ".git"
![Page 13: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/13.jpg)
Adding and commiting
You commit a file in two stages. First you add the file to the stagging area
Then when you have added all the changes you want to include, you commit your changes to the repositoty
![Page 14: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/14.jpg)
Fetching and pushing
To get the latest version of a remote repository you use the command fetch and then you merge any changes
To send you work to a remote repository you use the command push, but you need to merge your change before
![Page 15: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/15.jpg)
Tagging
Two type of tags : Lightweight and annotated
Tags need to be pushed to other repository
To work from a tag you need to create a branch
![Page 16: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/16.jpg)
Creating a branch
A branch is just a movable pointer to a commit
HEAD is the pointer to the current branch
![Page 17: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/17.jpg)
Checking out a branch
When you create a branch you don't change the HEAD
You need to checkout the branch to start working on it
![Page 18: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/18.jpg)
Basic Merging
![Page 19: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/19.jpg)
Merge Conflicts
![Page 20: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/20.jpg)
GIT under the hood
![Page 21: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/21.jpg)
![Page 22: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/22.jpg)
![Page 23: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/23.jpg)
Initial state
![Page 24: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/24.jpg)
File 1 modified
![Page 25: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/25.jpg)
Add
![Page 26: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/26.jpg)
Commit
![Page 27: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/27.jpg)
Clone
![Page 28: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/28.jpg)
Local commits
![Page 29: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/29.jpg)
Origin Commits
![Page 30: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/30.jpg)
Fetch
![Page 31: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/31.jpg)
Merge
![Page 32: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/32.jpg)
Push
![Page 33: GIT](https://reader030.vdocument.in/reader030/viewer/2022032623/55cfa7d6bb61eb21558b46c8/html5/thumbnails/33.jpg)
Questions?