SlideShare a Scribd company logo
Created by: Teodora Achkozidou
Date: May 2020
 Terminology
 CVCS / DVCS
 What is GIT & what is GITHUB
 Quick Start
 Version control system
 Branches
 GIT basics
 Comparison in GIT
 Branching & Merging
 GIT rebase
 GIT stashing
Git Goals and Objectives
 Repository contain: files, history, configuration managed by GIT
 Working Directory / Repository
 Tree stages of GIT (Working directory, Staging area /pro commit staging
area/,Commit /GIT repository - history/)
 Remote repository (GITHUB)
 Master branch
What you get from VERSION CONTROL SYSTEM
Save you from creating multiple backups of your files
Allow multiple people to work on the same time on file
Track changes & also who have made the changes
Easy to switch back to folder versions as and when requiered
Make you more productive
Version Control is the management of changes to documents, computer program,
large websites and other collection of information
- Centralized Version Control System (CVCS)
- Distributed Version Control System (DVCS)
- CVCS uses a central server to store all
files
- It works on a single repository to which
users can directly access a central server
- Central server can be local on remote
machine directly connected to each of
the programers workstation
- Centralized repozitory is not localy available
- Since everithing is centralized in any case of the central server getting crash or
corrupted will result in losing the entire data of project
- In DVCS every contributor has a local
copy or clone of the main repository
- The developer can update their local
repository with new data from the
central server by an operation called
“pull” and affect changes to the main
repository bu an operation called
“push” from their local repository
- All operations are very fast because the tool need to access the HDD only
- Committing new change-set can be done locally without manipulating the data on
the main repository
- If the central server get crashed at any point of the time, the data can be easily
recovered from anyone of the contributors local repositories
The most widely used modern version control system in the world today is Git. Git
is a mature, actively maintained open source project originally developed in 2005 by
Linus Torvalds, the famous creator of the Linux operating system kernel. A
staggering number of software projects rely on Git for version control, including
commercial projects as well as open source.
Design philosophy:
- Free and open source
- blazingly fast
- Distributed
- Data assurance
We’ve established that Git is a version control system, similar but better than the
many alternatives available. So, what makes GitHub so special? Git is a command-
line tool, but the centre around which all things involving Git revolve is the hub—
GitHub.com—where developers store their projects and network with like minded
people.
A repository (usually abbreviated to “repo”) is a location where all the files for a
particular project are stored. Each project has its own repo, and you can access it
with a unique URL.
- First step is to download GIT from the link below, it is available for all operation
systems:
https://git-scm.com/downloads
- GIT Basic start configuration
$ git config --global user.name “Your Name Here”
$ git config --global user.email “email@example.com”
$ git config --list (show all properties)
$git help <attribute> (example: $git help add)
Enter to the folder you want to use for the project and open terminal on it
$git init
Commiting first file
$ git status
$ git add file.txt | $ git add . (add all files you made changes on)
$ git commit –m “message with wich you want to commit the file”
$ git push origin master (explanation after)
If you want to see the changes from certain user
$ git log --author ”name”
Working
Area
Staging Repository
Verify changes in GIT
$ git diff
Compare staged with repo in GIT
$git diff --staged
Delete file
$git rm file.txt
GIT – DVCS is a tool
GITHUB is
- Code hosting platform
- Central repository
- Repository hosting service
To create a central repository:
$ git pull origin master
$ git clone https://github.com/user/repo
$ git push origin master
- Branch in GIT is pointer to commit
- To create a new branch we use the following command:
$ git branch <branch_name>
$ git branch development
$ git checkout development (to switch branches)
$ git branch (to check in which branch you are)
- Get to the branch you want to merge the changes (for example from development
to master)
$ git checkout master
$ git merge development
$ git push origin master (sync with github)
$ git reset HEAD filename
(HEAD - alias for the current branch ex. $git reset master|development filename)
$ git reset HEAD~ filename
(HEAD~ last commit reverted | HEAD~5 delete the last 5 commits from the
history)
The prefered command for many cases is
$ git revert commit_id
You can coppy the commit_id from
$ git log
$ git reset HEAD filename
$ git checkout --filename
$git rm –rf directory
(r – recursive, f – force, all in the direcory)
$ git commit –m “message” | $ git push origin master
$ git mv filename new_filename
$ git mv filename new_dir_path
Command to verify last commit
$ git log
Get GIT abbrev commit hash
$ git log --abbrev --log
GIT oneline commit
$ git log --oneline --graph --decorate
Logs that have been executed last day or last 5 days
$ git log --since=“5 days ago”
$ git show commit_id
$ git help log
GIT alias is a short way to display a results from long command
In order to add an alias we need to add the alias at GIT global config
$ git config --global <shot_command> “long_command”
Example: $ git config global alias.history “log --all --graph --decorate --oneline”
or:
$ nano ~/gitconfig
$ nano .gitignore
GIT ignore pattern example:
# exclude everything except directory
/*
!/dir
/dir/*
!/dir/bar
Working directory and staging directory
$ git diff
$ git fiff filename
Compare working directory and repository
$ git diff HEAD (compare working directory with last commit)
$ git diff HEAD filename
Staging area and repository
$ git diff --staged HEAD
$ git diff --staged HEAD filename
Compare commits in GIT
$ git diff commit_it commit_it
$ git diff HEAD HEAD^ (compare last commit and the commit previews last head -
1)
Verify branch
$ git branch -a
Switch GIT branches
$ git checkout <branch_name>
Rename branch
$ git branch –m <old_name> <new_name>
Delete branch
$ git branch -d <branch_name>
(before delete branch switch to another)
Merge one branch to another
$ git merge <source>
Example (first move to master):
$ git merge development
Git and github
- GIT merge create a new “merge commit” in the development branch that ties
together the histories of both branches, giving you a branch structure that looks
like graph
- How this impact:
in this case development branch will have an extraneous merge commit
every time you need to incorporate upstream chanches. If master is very
active this can pollute your development branch history.
- As an alternative to merging you can rebase the development branch into master
branch
$ git chechout development_branch
$git rebase master
- This moves the entire development branch to begin on the top of the master
branch, efectively incorporating all of the new commits in the master. Instead of
using merge commit, re-base re-write the project history by creating brand new
commits for each commit in the original branch
- Benefits:
you get much cleanier project history, it also result in the perfectly linear
project history
What is GIT Stash?
- When you create a stash, you are saving uncommitted changes so that you can
work on other things without losing your changes.
Example: you are working on a function, but your boss want you to do something
immediately and you need to change branches and your code is not ready for
commit and you does not want to loose your work as well… so you stash 
$ git stash save “message of what you were doing”
$ git stash list (list the changes made on stash with them id)
In order to work again on the stashed file:
$ git stash apply stash_id (example: stash@{1})
When you’re ready to finalize these saved changes, you have two options: apply or
pop.
- Apply will take the stashed changes, apply them to your working directory, and
keep the changes saved as a stash.
$ git stash apply stash@{0}
- Pop will do the exact same thing for the first two steps, but it will permanently
delete the stash.
$ git stash pop (will drag the very first stash on the stash list)
- Discard the stashed changes:
$ git stash drop stash@{0}
- Discard all stashed changes:
$ git stash clear
Git and github
Ad

More Related Content

What's hot (20)

Git github
Git githubGit github
Git github
Anurag Deb
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
Md. Main Uddin Rony
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
Ashok Kumar Satuluri
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs github
Vinoth Kannan
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
Mohammad Imam Hossain
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
Mizan Riqzia
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Bioinformatics and Computational Biosciences Branch
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
Edward Goikhman
 
Git
GitGit
Git
Hanokh Aloni
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
SlideTeam
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
GoogleDeveloperStude4
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
Shawn Doyle
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Git, Beginner to Advanced Survey
Git, Beginner to Advanced SurveyGit, Beginner to Advanced Survey
Git, Beginner to Advanced Survey
Rafal Rusin
 
Git
GitGit
Git
Parag Gupta
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs github
Vinoth Kannan
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
Mohammad Imam Hossain
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
Mizan Riqzia
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
SlideTeam
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
Shawn Doyle
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Git, Beginner to Advanced Survey
Git, Beginner to Advanced SurveyGit, Beginner to Advanced Survey
Git, Beginner to Advanced Survey
Rafal Rusin
 

Similar to Git and github (20)

Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Md Atique Ahmed Ziad
 
Git and GitHUB Explanation and simple coding for CLI
Git and GitHUB Explanation and simple coding for CLIGit and GitHUB Explanation and simple coding for CLI
Git and GitHUB Explanation and simple coding for CLI
kumaresan7751
 
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.pptgit2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
loleto7559
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
MohammadSamiuddin10
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
GitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna UniversityGitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
HuthaifaAlmaqrami1
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commands
Zakaria Bouazza
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan Maulana
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
ssusered2ec2
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Git and GitHUB Explanation and simple coding for CLI
Git and GitHUB Explanation and simple coding for CLIGit and GitHUB Explanation and simple coding for CLI
Git and GitHUB Explanation and simple coding for CLI
kumaresan7751
 
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.pptgit2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt
loleto7559
 
GitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna UniversityGitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commands
Zakaria Bouazza
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan Maulana
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Ad

Recently uploaded (20)

Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Ad

Git and github

  • 1. Created by: Teodora Achkozidou Date: May 2020
  • 2.  Terminology  CVCS / DVCS  What is GIT & what is GITHUB  Quick Start  Version control system  Branches  GIT basics  Comparison in GIT  Branching & Merging  GIT rebase  GIT stashing
  • 3. Git Goals and Objectives  Repository contain: files, history, configuration managed by GIT  Working Directory / Repository  Tree stages of GIT (Working directory, Staging area /pro commit staging area/,Commit /GIT repository - history/)  Remote repository (GITHUB)  Master branch
  • 4. What you get from VERSION CONTROL SYSTEM Save you from creating multiple backups of your files Allow multiple people to work on the same time on file Track changes & also who have made the changes Easy to switch back to folder versions as and when requiered Make you more productive
  • 5. Version Control is the management of changes to documents, computer program, large websites and other collection of information - Centralized Version Control System (CVCS) - Distributed Version Control System (DVCS)
  • 6. - CVCS uses a central server to store all files - It works on a single repository to which users can directly access a central server - Central server can be local on remote machine directly connected to each of the programers workstation
  • 7. - Centralized repozitory is not localy available - Since everithing is centralized in any case of the central server getting crash or corrupted will result in losing the entire data of project
  • 8. - In DVCS every contributor has a local copy or clone of the main repository - The developer can update their local repository with new data from the central server by an operation called “pull” and affect changes to the main repository bu an operation called “push” from their local repository
  • 9. - All operations are very fast because the tool need to access the HDD only - Committing new change-set can be done locally without manipulating the data on the main repository - If the central server get crashed at any point of the time, the data can be easily recovered from anyone of the contributors local repositories
  • 10. The most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source. Design philosophy: - Free and open source - blazingly fast - Distributed - Data assurance
  • 11. We’ve established that Git is a version control system, similar but better than the many alternatives available. So, what makes GitHub so special? Git is a command- line tool, but the centre around which all things involving Git revolve is the hub— GitHub.com—where developers store their projects and network with like minded people. A repository (usually abbreviated to “repo”) is a location where all the files for a particular project are stored. Each project has its own repo, and you can access it with a unique URL.
  • 12. - First step is to download GIT from the link below, it is available for all operation systems: https://git-scm.com/downloads - GIT Basic start configuration $ git config --global user.name “Your Name Here” $ git config --global user.email “[email protected]” $ git config --list (show all properties) $git help <attribute> (example: $git help add)
  • 13. Enter to the folder you want to use for the project and open terminal on it $git init Commiting first file $ git status $ git add file.txt | $ git add . (add all files you made changes on) $ git commit –m “message with wich you want to commit the file” $ git push origin master (explanation after) If you want to see the changes from certain user $ git log --author ”name”
  • 15. Verify changes in GIT $ git diff Compare staged with repo in GIT $git diff --staged Delete file $git rm file.txt
  • 16. GIT – DVCS is a tool GITHUB is - Code hosting platform - Central repository - Repository hosting service To create a central repository: $ git pull origin master $ git clone https://github.com/user/repo $ git push origin master
  • 17. - Branch in GIT is pointer to commit - To create a new branch we use the following command: $ git branch <branch_name> $ git branch development $ git checkout development (to switch branches) $ git branch (to check in which branch you are)
  • 18. - Get to the branch you want to merge the changes (for example from development to master) $ git checkout master $ git merge development $ git push origin master (sync with github)
  • 19. $ git reset HEAD filename (HEAD - alias for the current branch ex. $git reset master|development filename) $ git reset HEAD~ filename (HEAD~ last commit reverted | HEAD~5 delete the last 5 commits from the history) The prefered command for many cases is $ git revert commit_id You can coppy the commit_id from $ git log
  • 20. $ git reset HEAD filename $ git checkout --filename $git rm –rf directory (r – recursive, f – force, all in the direcory) $ git commit –m “message” | $ git push origin master $ git mv filename new_filename $ git mv filename new_dir_path
  • 21. Command to verify last commit $ git log Get GIT abbrev commit hash $ git log --abbrev --log GIT oneline commit $ git log --oneline --graph --decorate Logs that have been executed last day or last 5 days $ git log --since=“5 days ago” $ git show commit_id $ git help log
  • 22. GIT alias is a short way to display a results from long command In order to add an alias we need to add the alias at GIT global config $ git config --global <shot_command> “long_command” Example: $ git config global alias.history “log --all --graph --decorate --oneline” or: $ nano ~/gitconfig
  • 23. $ nano .gitignore GIT ignore pattern example: # exclude everything except directory /* !/dir /dir/* !/dir/bar
  • 24. Working directory and staging directory $ git diff $ git fiff filename Compare working directory and repository $ git diff HEAD (compare working directory with last commit) $ git diff HEAD filename Staging area and repository $ git diff --staged HEAD $ git diff --staged HEAD filename Compare commits in GIT $ git diff commit_it commit_it $ git diff HEAD HEAD^ (compare last commit and the commit previews last head - 1)
  • 25. Verify branch $ git branch -a Switch GIT branches $ git checkout <branch_name> Rename branch $ git branch –m <old_name> <new_name> Delete branch $ git branch -d <branch_name> (before delete branch switch to another) Merge one branch to another $ git merge <source> Example (first move to master): $ git merge development
  • 27. - GIT merge create a new “merge commit” in the development branch that ties together the histories of both branches, giving you a branch structure that looks like graph - How this impact: in this case development branch will have an extraneous merge commit every time you need to incorporate upstream chanches. If master is very active this can pollute your development branch history.
  • 28. - As an alternative to merging you can rebase the development branch into master branch $ git chechout development_branch $git rebase master - This moves the entire development branch to begin on the top of the master branch, efectively incorporating all of the new commits in the master. Instead of using merge commit, re-base re-write the project history by creating brand new commits for each commit in the original branch - Benefits: you get much cleanier project history, it also result in the perfectly linear project history
  • 29. What is GIT Stash? - When you create a stash, you are saving uncommitted changes so that you can work on other things without losing your changes. Example: you are working on a function, but your boss want you to do something immediately and you need to change branches and your code is not ready for commit and you does not want to loose your work as well… so you stash  $ git stash save “message of what you were doing” $ git stash list (list the changes made on stash with them id) In order to work again on the stashed file: $ git stash apply stash_id (example: stash@{1})
  • 30. When you’re ready to finalize these saved changes, you have two options: apply or pop. - Apply will take the stashed changes, apply them to your working directory, and keep the changes saved as a stash. $ git stash apply stash@{0} - Pop will do the exact same thing for the first two steps, but it will permanently delete the stash. $ git stash pop (will drag the very first stash on the stash list)
  • 31. - Discard the stashed changes: $ git stash drop stash@{0} - Discard all stashed changes: $ git stash clear