SlideShare a Scribd company logo
Code Version Control (Git)
By Ren Sothearin
Prerequisite
● Basic Linux Command (Optional)
● Familiar with Command Prompt/ Terminal
● Have GitLab/ GitHub/ Bitbucket Account
● Commitment to solve the conflict ^^
IDE
● (Windows) : required to use GitBash.
○ Download link: https://git-scm.com/downloads
● (Mac) : can use Mac Terminal, (optional) install “ohmyz.sh”
○ Go to terminal and add “$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-
zsh/master/tools/install.sh)"”
What is Git?
Git (/ɡɪt/) is a version control system (VCS) for tracking changes in computer files and
coordinating work on those files among multiple people. It is primarily used for
software development, but it can be used to keep track of changes in any files. As a
distributed revision control system it is aimed at speed, data integrity, and support for
distributed, non-linear workflows.
When was it invented?
Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with
other kernel developers contributing to its initial development. Its current maintainer
since 2005 is Junio Hamano.
What are the specialities in Git?
As with most other distributed version control systems, and unlike most client–server
systems, every Git directory on every computer is a full-fledged repository with
complete history and full version tracking abilities, independent of network access or a
central server.
Note: Git is free software distributed under the terms of the GNU General Public
License version 2
Git Web Interface
1. Famous
a. GitHub
b. GitLab
c. Bitbucket
2. Not familiar
Gitweb, Wit, Cgit, Gitorious,
Trac, Kallithea, Stash,
Springloops, Bonobo Git
Server
How to use
--distributed-even-if-your-workflow-isnt
Why GitLab?
https://about.gitlab.com/
● Free unlimited (Private)
repositories
● Free unlimited collaborators
● Friendly Interface
Basic Keyword
master - the repository’s main branch. Depending on the work flow it is the one people
work on or the one where the integration happens
clone - copies an existing git repository, normally from some remote location to your
local environment.
commit - submitting files to the repository (the local one); in other VCS it is often
referred to as “checkin”
fetch or pull - is like “update” or “get latest” in other VCS. The difference between fetch
and pull is that pull combines both, fetching the latest code from a remote repo as
Basic Keyword
push - is used to submit the code to a remote repository
remote - these are “remote” locations of your repository, normally on some central
server.
head - is a reference to the node to which our working space of the repository currently
points.
branch - is just like in other VCS with the difference that a branch in Git is actually
nothing more special than a particular label on a given node. It is not a physical copy
of the files as in other popular VCS.
Git Configuration
$ git config --global user.name "username": to config username with the git remote
repository
$ git config --global user.email example@example.com: to config username and email
with the git remote repository
$ git init : is used to initialize git in your local repository
Cloning project from a remote repository
$ git clone <remote_repo> : is used to clone the remote repository into local (clone
means copy)
Example: $ git clone git@gitlab.com:user/myproject.git
$ git clone -b <branch> <remote_repo> : is used to clone from a specific branch at the
remote repository into local
Example: $ git clone -b feature git@gitlab.com:user/myproject.git
This example means that we clone from branch “feature” at the remote
repository name “myproject”.
Adding file to a remote repository
$ git add <file_name> : is used to add the specific file name to the remote repository
$ git add . : is used to add all the changed file to the remote repository (Git will take a
snapshot of the contents of all files under the current directory (note the .))
$ git add -a/ $ git add -A : it will find new files as well as staging modified content and
removing files that are no longer in the working tree.
$ git add --all : the same as git add -a
$ git add * : the same as git add .
Committing file to a remote repository
$ git commit -m “message” : is used to commit the changes to head (but not yet to the
remote repository)
$ git commit -a : Commit any files you've added with git add, and also commit any files
you've changed since then
Pushing files to a remote repository
$ git push -u origin <branch_name> : is used to push the branch to your remote
repository, so others can use it.
Example: git push -u origin master
● $ git push origin <branch_name> : is used to push the branch to your remote
repository, so others can use it.
Example: git push origin master
● $ git push --all origin : is used to push all branches to your remote repository
Pulling files from a remote repository
$ git pull : is used to pull the fast-forwards codes, files from the our own branch
Example: myproject (master) $ git pull
This means that we pull our own code from the remote repo into local
● $ git pull origin <branch_name> : is used to pull the fast-forwards codes, files from
the remote branch into our local
Example: myproject (master) $ git pull origin feature
Meaning, stands on “master’ branch and pull from “feature” branch
Git branch
$ git branch “branch_name” : is used to create a new branch name, after create we still
stand on the current branch
Example: myproject (master) $ git branch “feature” : means that we stands on
master and create a new branch called “feature”
● $ git checkout -b “branch_name” : is used to checkout and create a new branch
name, after create we change the current standing branch to the new branch
Example: myproject (master) $ git checkout -b “feature”
myproject (feature) $
Git branch
$ git branch : List all the branches in your repo, and also tell you what branch you're
currently in
Example: myproject (master) $ git branch
feature
*master
● $ git checkout <branch_name> : Switch from one branch to another branch
Example: myproject (master) $ git checkout feature
Git branch
$ git branch -d <branch_name> : is used to delete branch in the remote repo
Merging branch together
$ git merge <branch_name> : is used to merge a different branch into your active
branch.
Example: myproject (master) $ git merge feature
Means that we are merging “feature” into “master”
● $ git diff <source branch> <target branch> : is used to preview change on branch
before merge
Git fetch
$ git fetch : is used to fetch the changes in other branch into your current active branch
$ git fetch <branch_name> : is used to fetch the changes in the specific branch into your
current active branch
Undo local change
$ git checkout --<file_name> : is used to undo your local change in the file. If you mess
up, you can replace the changes in your working tree with the last content in head.
Changes already added to the index, as well as new files, will be kept.
Instead, to drop all your local changes and commits, fetch the latest history from the
server and point your local master branch at it, do this
$ git fetch origin
$ git reset --hard origin/master
Git log
$ git log : is used to see the changing history
$ git log -p : is used to see complete diffs at each step
Stash local change
$ git stash : is used to stash the local change that you have made in your local
repository. When you stash your code, your local change will remove and your tree
will look the same as what you have committed. After you stash dont worry that you
will lose your code, it just put somewhere in your computer.
$ git stash pop : is used to get what you stash back into your local repository. You can
get it back, but if you “git status” you won’t see any change file.
$ git reset HEAD <file> : is used get what you stash back after “stash pop”
Contact
Sothearin Ren
ren.sothearin@gmail.com
https://gitlab.com/Sothearin

More Related Content

What's hot

Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
th507
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
alignan
 
Android Libs - Retrofit
Android Libs - RetrofitAndroid Libs - Retrofit
Android Libs - Retrofit
Daniel Costa Gimenes
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
Bitbucket
BitbucketBitbucket
Bitbucket
hariprasad1035
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Basic Git
Basic GitBasic Git
Basic Git
Knut Haugen
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
SheilaJimenezMorejon
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
Tommaso Visconti
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
Mohammad Imam Hossain
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Git
GitGit
Git and github
Git and githubGit and github
Git and github
Teodora Ahkozidou
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
GoogleDeveloperStude4
 
Github
GithubGithub
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
Luis Lamadrid
 
Git and Github
Git and GithubGit and Github
Git and Github
Teodora Ahkozidou
 

What's hot (20)

Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
Android Libs - Retrofit
Android Libs - RetrofitAndroid Libs - Retrofit
Android Libs - Retrofit
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Basic Git
Basic GitBasic Git
Basic Git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git
GitGit
Git
 
Git and github
Git and githubGit and github
Git and github
 
Git training
Git trainingGit training
Git training
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Github
GithubGithub
Github
 
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
 
Git and Github
Git and GithubGit and Github
Git and Github
 

Similar to Understanding about git

Git basic
Git basicGit basic
Git basic
Akbar Uddin
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
Shubham Verma
 
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
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
UshaSuray
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
Prakash Dantuluri
 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
Weghlis Azzariou
 
Git
GitGit
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
簡單介紹git簡單介紹git
簡單介紹git
Grace Chien
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Ananth Kumar
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
Zeeshan Khan
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
A Quick Start - Version Control with Git
A Quick Start - Version Control with GitA Quick Start - Version Control with Git
A Quick Start - Version Control with Git
Dmitry Sheiko
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 

Similar to Understanding about git (20)

Git basic
Git basicGit basic
Git basic
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
 
Git
GitGit
Git
 
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
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Git 101
Git 101Git 101
Git 101
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
A Quick Start - Version Control with Git
A Quick Start - Version Control with GitA Quick Start - Version Control with Git
A Quick Start - Version Control with Git
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Learning git
Learning gitLearning git
Learning git
 

Recently uploaded

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 

Understanding about git

  • 1. Code Version Control (Git) By Ren Sothearin
  • 2. Prerequisite ● Basic Linux Command (Optional) ● Familiar with Command Prompt/ Terminal ● Have GitLab/ GitHub/ Bitbucket Account ● Commitment to solve the conflict ^^
  • 3. IDE ● (Windows) : required to use GitBash. ○ Download link: https://git-scm.com/downloads ● (Mac) : can use Mac Terminal, (optional) install “ohmyz.sh” ○ Go to terminal and add “$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my- zsh/master/tools/install.sh)"”
  • 4. What is Git? Git (/ɡɪt/) is a version control system (VCS) for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for software development, but it can be used to keep track of changes in any files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.
  • 5. When was it invented? Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano.
  • 6. What are the specialities in Git? As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version tracking abilities, independent of network access or a central server. Note: Git is free software distributed under the terms of the GNU General Public License version 2
  • 7. Git Web Interface 1. Famous a. GitHub b. GitLab c. Bitbucket 2. Not familiar Gitweb, Wit, Cgit, Gitorious, Trac, Kallithea, Stash, Springloops, Bonobo Git Server
  • 8.
  • 10. Why GitLab? https://about.gitlab.com/ ● Free unlimited (Private) repositories ● Free unlimited collaborators ● Friendly Interface
  • 11. Basic Keyword master - the repository’s main branch. Depending on the work flow it is the one people work on or the one where the integration happens clone - copies an existing git repository, normally from some remote location to your local environment. commit - submitting files to the repository (the local one); in other VCS it is often referred to as “checkin” fetch or pull - is like “update” or “get latest” in other VCS. The difference between fetch and pull is that pull combines both, fetching the latest code from a remote repo as
  • 12. Basic Keyword push - is used to submit the code to a remote repository remote - these are “remote” locations of your repository, normally on some central server. head - is a reference to the node to which our working space of the repository currently points. branch - is just like in other VCS with the difference that a branch in Git is actually nothing more special than a particular label on a given node. It is not a physical copy of the files as in other popular VCS.
  • 13. Git Configuration $ git config --global user.name "username": to config username with the git remote repository $ git config --global user.email example@example.com: to config username and email with the git remote repository $ git init : is used to initialize git in your local repository
  • 14. Cloning project from a remote repository $ git clone <remote_repo> : is used to clone the remote repository into local (clone means copy) Example: $ git clone git@gitlab.com:user/myproject.git $ git clone -b <branch> <remote_repo> : is used to clone from a specific branch at the remote repository into local Example: $ git clone -b feature git@gitlab.com:user/myproject.git This example means that we clone from branch “feature” at the remote repository name “myproject”.
  • 15. Adding file to a remote repository $ git add <file_name> : is used to add the specific file name to the remote repository $ git add . : is used to add all the changed file to the remote repository (Git will take a snapshot of the contents of all files under the current directory (note the .)) $ git add -a/ $ git add -A : it will find new files as well as staging modified content and removing files that are no longer in the working tree. $ git add --all : the same as git add -a $ git add * : the same as git add .
  • 16. Committing file to a remote repository $ git commit -m “message” : is used to commit the changes to head (but not yet to the remote repository) $ git commit -a : Commit any files you've added with git add, and also commit any files you've changed since then
  • 17. Pushing files to a remote repository $ git push -u origin <branch_name> : is used to push the branch to your remote repository, so others can use it. Example: git push -u origin master ● $ git push origin <branch_name> : is used to push the branch to your remote repository, so others can use it. Example: git push origin master ● $ git push --all origin : is used to push all branches to your remote repository
  • 18. Pulling files from a remote repository $ git pull : is used to pull the fast-forwards codes, files from the our own branch Example: myproject (master) $ git pull This means that we pull our own code from the remote repo into local ● $ git pull origin <branch_name> : is used to pull the fast-forwards codes, files from the remote branch into our local Example: myproject (master) $ git pull origin feature Meaning, stands on “master’ branch and pull from “feature” branch
  • 19. Git branch $ git branch “branch_name” : is used to create a new branch name, after create we still stand on the current branch Example: myproject (master) $ git branch “feature” : means that we stands on master and create a new branch called “feature” ● $ git checkout -b “branch_name” : is used to checkout and create a new branch name, after create we change the current standing branch to the new branch Example: myproject (master) $ git checkout -b “feature” myproject (feature) $
  • 20. Git branch $ git branch : List all the branches in your repo, and also tell you what branch you're currently in Example: myproject (master) $ git branch feature *master ● $ git checkout <branch_name> : Switch from one branch to another branch Example: myproject (master) $ git checkout feature
  • 21. Git branch $ git branch -d <branch_name> : is used to delete branch in the remote repo
  • 22. Merging branch together $ git merge <branch_name> : is used to merge a different branch into your active branch. Example: myproject (master) $ git merge feature Means that we are merging “feature” into “master” ● $ git diff <source branch> <target branch> : is used to preview change on branch before merge
  • 23. Git fetch $ git fetch : is used to fetch the changes in other branch into your current active branch $ git fetch <branch_name> : is used to fetch the changes in the specific branch into your current active branch
  • 24. Undo local change $ git checkout --<file_name> : is used to undo your local change in the file. If you mess up, you can replace the changes in your working tree with the last content in head. Changes already added to the index, as well as new files, will be kept. Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this $ git fetch origin $ git reset --hard origin/master
  • 25. Git log $ git log : is used to see the changing history $ git log -p : is used to see complete diffs at each step
  • 26. Stash local change $ git stash : is used to stash the local change that you have made in your local repository. When you stash your code, your local change will remove and your tree will look the same as what you have committed. After you stash dont worry that you will lose your code, it just put somewhere in your computer. $ git stash pop : is used to get what you stash back into your local repository. You can get it back, but if you “git status” you won’t see any change file. $ git reset HEAD <file> : is used get what you stash back after “stash pop”