SlideShare a Scribd company logo
1 of 8
GETTING STARTED WITH GIT
• git is a vcs version control system for managing code.
• git is a centralized distributed vcs
• github requires subscription for private repos, on bitbucket we can have a free private repo.
pawaan.v[at]gmail.com
HANDS ON USING LINUX DISTRO OR WSL ON WINDOWS
• If you are windows 10 wsl (windows subsystem for linux) a full blown Ubuntu distoro can be installed
ref : https://docs.microsoft.com/en-us/windows/wsl/install-win10
• On linux install git from apt for deb based distros and yum/dnf for rpm based distros
#apt-get install git -y
#yum install git -y
#git --version
• Check wsl home directory from command
#echo $HOME
#echo $USER
• Navigate to windows user directory using the command
#cd /mnt/c/Users/username
#ls
•
pawaan.v[at]gmail.c
GENERATING AND ADDING SSH KEYS TO GITHUB OR BITBUCKET
• ssh-keygen –t rsa -b 4096 -C email@example.com
• eval $(ssh-agent -s)
• ssh-add ~/.ssh/id_rsa
• Verify the permissions of id_rsa to be 600
• Once the key is generated add it to
git at: https://github.com/settings/keys
bitbucket at: https://bitbucket.org/account/user/<user>/ssh-keys
• Testing ssh authentication to git and bitbucket
ssh -T git@github.com
ssh -T git@bitbucket.org
• Configuring global options
#git config --global --edit
CLONING INTO AN EXISTING GIT PROJECT
• Git clone is used to clone an existing project from git, pull can be http based and ssh based.
-If a pull is done from http method , when the user wants to push the code every time the
authentication needs to be entered.
-If code is pulled using ssh , user need not provide credentials every time while pushing the code
taking into account that ssh keys are already added to the account
• #git clone https://github.com/pawaanv/cipher-setup
#cd cipher-setup
#echo “adding Version file”
#echo “version 1.0 > version”
#git commit -m “added version name”
#git push
• Create a empty git project
#mkdir njord
#cd njord
#git init
#ls
ALIASES
• Shorthand commands for git instead of typing long commands
#git config --global alias.co checkout
#git config --global alias.br branch
#git config --global alias.ci commit
#git config --global alias.st status
#git config --global alias.cl clone
#git conifg --global alias.ph push
#git config --global alias.pl pull
#git pl --help
• While storing files on git we don’t want to put password files and confidential info in public repos,
avoiding larger files
#echo “passwords” > .gitignore
• Checking the difference between the commits
#git diff commit1 commit2
GIT CUSTOMIZATION
• #git status
#git config -l
#git config -e
#git config --global user.name “Pawan kumar”
#git config --global user.email pawaan.v@gmail.com
#git conig --global color.ui auto
#git status
refer : https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
• Adding files to the empty git repo
#touch httpd.sh
#git add httpd.sh
#git add -A
#echo > “#!/bin/bash”
#git commit –m “apache”
#git push -v
#git status
if you are single user working on the git with multiple devices and want to get the latest changes to be
pulled then add below code to .bashrc
#echo >> “git -C ~$USER/cipher-setup/ pull” >> $HOME/.bashrc
REMOTE GIT REPOS, TAGS
• Check the remote git repo status from command
#git remote –v
#git remote add pb https://bitbucket.org/cipheronic/cipher-setup
#git fetch pb
#git remote show origin
#git remote rename pb cipher
#git remote
#git remote remove cipher
#git remote
• Git repos can be tagged in history
there are two types of tags “Annotated tags & lightweight” tags
Annotated tags store full git objects and databases
Lightweight tags are like branches they just pointers to the git branch location
#git tag -a v.1 -m “my version v.1”
#git show v.1
git push does not push the tags it has to be done explicitly
#git push origin v.1
To push all the tags
#git push origin --tags
GIT BRANCHING
• By default user will be working in master branch ( default which is created when git init is run)
user check check the current branch they are working under using the command
#git branch
• New branch can be added with the command
#git branch test
#git branch -v
• User can switch to the new branch with the command
#git brahch test
#git checkout test
or
#git checkout -b test
#git branch –d test
#git branch --merged
#git branch --no-merged
• Logs
#git log
#git log --oneline –decorate
#git log --pretty=oneline
#git
pawaan.v[at]gmail.c

More Related Content

What's hot

MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!
MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!
MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!Stennie Steneker
 
How to install git on ubuntu
How to install git on ubuntuHow to install git on ubuntu
How to install git on ubuntubaran19901990
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG AntwerpKrimson
 
Git for a newbie
Git for a newbieGit for a newbie
Git for a newbieAnuj Sharma
 
Getting started & Hosting your website on GitHub
Getting started & Hosting your website on GitHubGetting started & Hosting your website on GitHub
Getting started & Hosting your website on GitHubKartik Kannapur
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Luis atencio on_git
Luis atencio on_gitLuis atencio on_git
Luis atencio on_gitLuis Atencio
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in GoBo-Yi Wu
 
Fall18 Git presentation
Fall18 Git presentationFall18 Git presentation
Fall18 Git presentationJustinTirrell1
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsBo-Yi Wu
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 

What's hot (20)

Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Git Gyan
Git GyanGit Gyan
Git Gyan
 
MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!
MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!
MongoDB World 2019 Builder's Fest - Ready, Git set ... Go!
 
How to install git on ubuntu
How to install git on ubuntuHow to install git on ubuntu
How to install git on ubuntu
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG Antwerp
 
Git for a newbie
Git for a newbieGit for a newbie
Git for a newbie
 
Getting started & Hosting your website on GitHub
Getting started & Hosting your website on GitHubGetting started & Hosting your website on GitHub
Getting started & Hosting your website on GitHub
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Luis atencio on_git
Luis atencio on_gitLuis atencio on_git
Luis atencio on_git
 
Git workshop
Git workshopGit workshop
Git workshop
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in Go
 
Fall18 Git presentation
Fall18 Git presentationFall18 Git presentation
Fall18 Git presentation
 
Git advanced
Git advancedGit advanced
Git advanced
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Git cli
Git cliGit cli
Git cli
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git 101
Git 101Git 101
Git 101
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 

Similar to Getting started with git

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
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 UnityRifauddin Tsalitsy
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)TAWS
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a GitJuan Antonio
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
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 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Brian K. Vagnini
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with GitThings Lab
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 

Similar to Getting started with git (20)

Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
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
 
Git Heaven with Wakanda
Git Heaven with WakandaGit Heaven with Wakanda
Git Heaven with Wakanda
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Git hub
Git hubGit hub
Git hub
 
Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Git
GitGit
Git
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Git basics
Git basicsGit basics
Git basics
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Getting started with git

  • 1. GETTING STARTED WITH GIT • git is a vcs version control system for managing code. • git is a centralized distributed vcs • github requires subscription for private repos, on bitbucket we can have a free private repo. pawaan.v[at]gmail.com
  • 2. HANDS ON USING LINUX DISTRO OR WSL ON WINDOWS • If you are windows 10 wsl (windows subsystem for linux) a full blown Ubuntu distoro can be installed ref : https://docs.microsoft.com/en-us/windows/wsl/install-win10 • On linux install git from apt for deb based distros and yum/dnf for rpm based distros #apt-get install git -y #yum install git -y #git --version • Check wsl home directory from command #echo $HOME #echo $USER • Navigate to windows user directory using the command #cd /mnt/c/Users/username #ls • pawaan.v[at]gmail.c
  • 3. GENERATING AND ADDING SSH KEYS TO GITHUB OR BITBUCKET • ssh-keygen –t rsa -b 4096 -C email@example.com • eval $(ssh-agent -s) • ssh-add ~/.ssh/id_rsa • Verify the permissions of id_rsa to be 600 • Once the key is generated add it to git at: https://github.com/settings/keys bitbucket at: https://bitbucket.org/account/user/<user>/ssh-keys • Testing ssh authentication to git and bitbucket ssh -T git@github.com ssh -T git@bitbucket.org • Configuring global options #git config --global --edit
  • 4. CLONING INTO AN EXISTING GIT PROJECT • Git clone is used to clone an existing project from git, pull can be http based and ssh based. -If a pull is done from http method , when the user wants to push the code every time the authentication needs to be entered. -If code is pulled using ssh , user need not provide credentials every time while pushing the code taking into account that ssh keys are already added to the account • #git clone https://github.com/pawaanv/cipher-setup #cd cipher-setup #echo “adding Version file” #echo “version 1.0 > version” #git commit -m “added version name” #git push • Create a empty git project #mkdir njord #cd njord #git init #ls
  • 5. ALIASES • Shorthand commands for git instead of typing long commands #git config --global alias.co checkout #git config --global alias.br branch #git config --global alias.ci commit #git config --global alias.st status #git config --global alias.cl clone #git conifg --global alias.ph push #git config --global alias.pl pull #git pl --help • While storing files on git we don’t want to put password files and confidential info in public repos, avoiding larger files #echo “passwords” > .gitignore • Checking the difference between the commits #git diff commit1 commit2
  • 6. GIT CUSTOMIZATION • #git status #git config -l #git config -e #git config --global user.name “Pawan kumar” #git config --global user.email pawaan.v@gmail.com #git conig --global color.ui auto #git status refer : https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration • Adding files to the empty git repo #touch httpd.sh #git add httpd.sh #git add -A #echo > “#!/bin/bash” #git commit –m “apache” #git push -v #git status if you are single user working on the git with multiple devices and want to get the latest changes to be pulled then add below code to .bashrc #echo >> “git -C ~$USER/cipher-setup/ pull” >> $HOME/.bashrc
  • 7. REMOTE GIT REPOS, TAGS • Check the remote git repo status from command #git remote –v #git remote add pb https://bitbucket.org/cipheronic/cipher-setup #git fetch pb #git remote show origin #git remote rename pb cipher #git remote #git remote remove cipher #git remote • Git repos can be tagged in history there are two types of tags “Annotated tags & lightweight” tags Annotated tags store full git objects and databases Lightweight tags are like branches they just pointers to the git branch location #git tag -a v.1 -m “my version v.1” #git show v.1 git push does not push the tags it has to be done explicitly #git push origin v.1 To push all the tags #git push origin --tags
  • 8. GIT BRANCHING • By default user will be working in master branch ( default which is created when git init is run) user check check the current branch they are working under using the command #git branch • New branch can be added with the command #git branch test #git branch -v • User can switch to the new branch with the command #git brahch test #git checkout test or #git checkout -b test #git branch –d test #git branch --merged #git branch --no-merged • Logs #git log #git log --oneline –decorate #git log --pretty=oneline #git pawaan.v[at]gmail.c