SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
1
Why Git
2
Before Git?
3
Source Control
with Git
4
Understanding
the Git File
System
5
6
Create a working directory mkdir my_app
C:UsersjatinDesktopmy_app
Working directory
.gitgit init
touch
readme.md
Staging Area git add .
Branch(master)
git commit
Branch
(feature)
git branch feature
Creating a Local
Repository
7
Creating a local repository
Command to use:
8
git init
Example:
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1
$ git init
Creates a new git repository in a particular folder.
OR
Creates a new local repository with the specified name
Configuration
of Git
9
Setting up configuration in git
Command to use:
10
git config --global user.name <name>
git config --global.email <email>
Example:
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master)
$ git config --global user.name "Jatin Sharma"
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master)
$ git config --global user.email "jatinvsharma@gmail.com"
Sets up the identity for a user in the repository
Adding files to
Git Repo
11
git add
12
Working directory
.git
Staging Area git add .
Adding Files to git Repo
Command to use:
13
Git add <fileName>
Git add .
Adds the file to the staging area of the git
Removing a file from git
Command to use:
14
Git rm <fileName>
Removes the git repository
GIT Status
15
Git Status Command
Command to use:
16
git status
git status -s
git status -v
Example 1:
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master)
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD ..." to unstage)
new file: src1/demo.txt
new file: src2/demo.txt
new file: src3/demo.txt
Shows the state of your staged and unstaged files.
Example 2
17
Command: git status -s
Outputs the file in shortend format
Example:
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master)
$ git status -s
A src1/demo.txt
A src2/demo.txt
A src3/demo.txt
?? readme.txt
A: Files are staged
??: Files are not tracked
Example 3
18
Example: Stage the new file using git add readme.txt
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master)
$ git status -s
A src1/demo.txt
A src2/demo.txt
A src3/demo.txt
A readme.txt
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1
(master)
$ echo "jatin" >>readme.txt
jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1
(master)
$ git status -s
AM readme.txt
A src1/demo.txt
A src2/demo.txt
A src3/demo.txt
Example 4
19
Command: git status -v
Outputs the file in verbose format (Means detailed output)
Example:
In Comment Section
Commit to Git
Repo
20
Commiting to Git Repo
Command to use:
21
Git commit
Git commit -m “Commit Message”
Git commit -a -m “Message”
Long Way:
Opens a text editor so that you right your commit message!
Shorter Way:
Git commit -m “Commit Message”
Git commit -a -m “Message”
.gitIgnore
22
Ignoring file in git
Command to use:
23
Create a file call .gitIgnore
.gitIgnore will ignore files in a git repository.
Files are excluded based on wildcard pattern!
QUIZ
24
Click here
ADVANCE GIT
25
Tagging in Git
26
Tag in Git
Command to use:
27
git tag -a [tag] -m "msg"
A TAG is used to mark a specific commit in your project.
Eg Version Number.
Two Types of Tag in Git:
1. Annotated Tags
2. Lightweight Tags
Annotated Vs LightWeight
Lightweight tags are just pointers to specific commits. No further information is
saved.
Annotated tags are regular objects, which have an author and a date and can be
referred.
If knowing who tagged what and when is relevant for you, then use annotated
tags.
If you just want to tag a specific point in your development, no matter who and
when did that, then lightweight tags are good enough.
Mostly All companies used Annotated Tags
28
Branches
29
Branches
Command to use:
30
Git branch <branch Name>
Git Checkout <Branch Name>
This is helpful so that you can work on a different development line
without altering your stable line of work.
Merging Branches
Command to use:
31
Git branch <branch Name>
Git Checkout <Branch Name>
This is helpful so that you can work on a different development line
without altering your stable line of work.
Solving Merge
Conflict
32
Rebasing
33
Alternate of Merging
Rebasing
Command to use:
34
Git rebase <branch Name>
Git Checkout <Branch Name>
Rebasing and merging are both designed to integrate changes
from one branch into another branch but in different ways.
You would likely use a rebase method of applying changes when you want
to push your own work to a remote repository
35
Logs in Git
36
Log Command
Command to use:
37
Git log
Git log --graph
Git log --stat
use the built-in logging functionality of git to keep track of what's going
on with the repository. We will use the git log command and some of its
more common options to format the log's output.
Cloning Repos
38
Clone Command
Command to use:
39
Git clone <localrepo> <new repo>
clone a local repository as a backup or as a testing ground for features or database
work
Clone usin HTTPS
Command to use:
40
Git clone <url>
clone remote repositories from popular sites such as GitHub onto your local system. We will clone over
HTTPS, and show you what you get when you clone a project
Push Request
41
Tracking a repo
Command to use:
42
Git remote -v
Shows the remote server that are being tracked for the current repository.
Fetch from Repo
Command to use:
43
Git fetch origin
Fetches new commit information from the remote server (eg github,gitlab) for the current repository.
It will not merge the files automatically on your local system.
If you want to pull automatically you need to use the git pull command.
Pushing to Remote Repositories
Command to use:
44
Git push -u <remote> <local>
Fetches new commit information from the remote server (eg github,gitlab) for the current repository.
It will not merge the files automatically on your local system.
If you want to pull automatically you need to use the git pull command.
Setting Up
GitLab
45
.git
folder
46
.git folder
▪ HEAD
▪ index
▪ Config
▪ Description
▪ COMMIT_EDITMSG
▪ Refs
▪ Objects
▪ Logs
▪ Info
▪ hooks
47
About my Course
48
49
Our Journey
Milestone 1 Milestone 2
}Testing
Module
Commands +
POM Framework
Milestone 3 Milestone 4
50
Unit
Test
API Tests UI Tests Publish
Postman
And Rest Assured
Selenium Tests
Docker image
}sonar
Code Quality

Más contenido relacionado

La actualidad más candente

TinkerPop and Titan from a Python State of Mind
TinkerPop and Titan from a  Python State of MindTinkerPop and Titan from a  Python State of Mind
TinkerPop and Titan from a Python State of MindDenise Gosnell, Ph.D.
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - GitCarlo Bernaschina
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHubviet nghiem
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with gitgdgjss
 
Introduction to GIT versioning
Introduction to GIT versioningIntroduction to GIT versioning
Introduction to GIT versioningStackit Community
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubRick Umali
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheetLam Hoang
 
Version Control with Git & GitHub
Version Control with Git & GitHubVersion Control with Git & GitHub
Version Control with Git & GitHubPiet Cordemans
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Graph Day Texas: Open Source Graph Projects from PokitDok
Graph Day Texas: Open Source Graph Projects from PokitDokGraph Day Texas: Open Source Graph Projects from PokitDok
Graph Day Texas: Open Source Graph Projects from PokitDokDenise Gosnell, Ph.D.
 
Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGandhi Ramu
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with gitDídac Ríos
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using GitYan Vugenfirer
 

La actualidad más candente (19)

TinkerPop and Titan from a Python State of Mind
TinkerPop and Titan from a  Python State of MindTinkerPop and Titan from a  Python State of Mind
TinkerPop and Titan from a Python State of Mind
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHub
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
Introduction to GIT versioning
Introduction to GIT versioningIntroduction to GIT versioning
Introduction to GIT versioning
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git commands
Git commandsGit commands
Git commands
 
Git
GitGit
Git
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Version Control with Git & GitHub
Version Control with Git & GitHubVersion Control with Git & GitHub
Version Control with Git & GitHub
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Graph Day Texas: Open Source Graph Projects from PokitDok
Graph Day Texas: Open Source Graph Projects from PokitDokGraph Day Texas: Open Source Graph Projects from PokitDok
Graph Day Texas: Open Source Graph Projects from PokitDok
 
Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_Guidewire
 
Git & github
Git & githubGit & github
Git & github
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 

Similar a Learn Git Fundamentals

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
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | WorkshopAnuchit Chalothorn
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheetsozone777
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptxgdscuds
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfmurad khan
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answersDeepQuest Software
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxAbelPhilipJoseph
 

Similar a Learn Git Fundamentals (20)

Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheets
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git
GitGit
Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answers
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Day 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptxDay 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptx
 
16 Git
16 Git16 Git
16 Git
 

Último

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Último (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Learn Git Fundamentals

  • 1. 1
  • 6. 6 Create a working directory mkdir my_app C:UsersjatinDesktopmy_app Working directory .gitgit init touch readme.md Staging Area git add . Branch(master) git commit Branch (feature) git branch feature
  • 8. Creating a local repository Command to use: 8 git init Example: jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 $ git init Creates a new git repository in a particular folder. OR Creates a new local repository with the specified name
  • 10. Setting up configuration in git Command to use: 10 git config --global user.name <name> git config --global.email <email> Example: jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git config --global user.name "Jatin Sharma" jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git config --global user.email "jatinvsharma@gmail.com" Sets up the identity for a user in the repository
  • 13. Adding Files to git Repo Command to use: 13 Git add <fileName> Git add . Adds the file to the staging area of the git
  • 14. Removing a file from git Command to use: 14 Git rm <fileName> Removes the git repository
  • 16. Git Status Command Command to use: 16 git status git status -s git status -v Example 1: jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git status On branch master Changes to be committed: (use "git reset HEAD ..." to unstage) new file: src1/demo.txt new file: src2/demo.txt new file: src3/demo.txt Shows the state of your staged and unstaged files.
  • 17. Example 2 17 Command: git status -s Outputs the file in shortend format Example: jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git status -s A src1/demo.txt A src2/demo.txt A src3/demo.txt ?? readme.txt A: Files are staged ??: Files are not tracked
  • 18. Example 3 18 Example: Stage the new file using git add readme.txt jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git status -s A src1/demo.txt A src2/demo.txt A src3/demo.txt A readme.txt jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ echo "jatin" >>readme.txt jatin@LAPTOP-LEI7GM17 MINGW64 ~/Desktop/AT-Batch May1 (master) $ git status -s AM readme.txt A src1/demo.txt A src2/demo.txt A src3/demo.txt
  • 19. Example 4 19 Command: git status -v Outputs the file in verbose format (Means detailed output) Example: In Comment Section
  • 21. Commiting to Git Repo Command to use: 21 Git commit Git commit -m “Commit Message” Git commit -a -m “Message” Long Way: Opens a text editor so that you right your commit message! Shorter Way: Git commit -m “Commit Message” Git commit -a -m “Message”
  • 23. Ignoring file in git Command to use: 23 Create a file call .gitIgnore .gitIgnore will ignore files in a git repository. Files are excluded based on wildcard pattern!
  • 27. Tag in Git Command to use: 27 git tag -a [tag] -m "msg" A TAG is used to mark a specific commit in your project. Eg Version Number. Two Types of Tag in Git: 1. Annotated Tags 2. Lightweight Tags
  • 28. Annotated Vs LightWeight Lightweight tags are just pointers to specific commits. No further information is saved. Annotated tags are regular objects, which have an author and a date and can be referred. If knowing who tagged what and when is relevant for you, then use annotated tags. If you just want to tag a specific point in your development, no matter who and when did that, then lightweight tags are good enough. Mostly All companies used Annotated Tags 28
  • 30. Branches Command to use: 30 Git branch <branch Name> Git Checkout <Branch Name> This is helpful so that you can work on a different development line without altering your stable line of work.
  • 31. Merging Branches Command to use: 31 Git branch <branch Name> Git Checkout <Branch Name> This is helpful so that you can work on a different development line without altering your stable line of work.
  • 34. Rebasing Command to use: 34 Git rebase <branch Name> Git Checkout <Branch Name> Rebasing and merging are both designed to integrate changes from one branch into another branch but in different ways. You would likely use a rebase method of applying changes when you want to push your own work to a remote repository
  • 35. 35
  • 37. Log Command Command to use: 37 Git log Git log --graph Git log --stat use the built-in logging functionality of git to keep track of what's going on with the repository. We will use the git log command and some of its more common options to format the log's output.
  • 39. Clone Command Command to use: 39 Git clone <localrepo> <new repo> clone a local repository as a backup or as a testing ground for features or database work
  • 40. Clone usin HTTPS Command to use: 40 Git clone <url> clone remote repositories from popular sites such as GitHub onto your local system. We will clone over HTTPS, and show you what you get when you clone a project
  • 42. Tracking a repo Command to use: 42 Git remote -v Shows the remote server that are being tracked for the current repository.
  • 43. Fetch from Repo Command to use: 43 Git fetch origin Fetches new commit information from the remote server (eg github,gitlab) for the current repository. It will not merge the files automatically on your local system. If you want to pull automatically you need to use the git pull command.
  • 44. Pushing to Remote Repositories Command to use: 44 Git push -u <remote> <local> Fetches new commit information from the remote server (eg github,gitlab) for the current repository. It will not merge the files automatically on your local system. If you want to pull automatically you need to use the git pull command.
  • 47. .git folder ▪ HEAD ▪ index ▪ Config ▪ Description ▪ COMMIT_EDITMSG ▪ Refs ▪ Objects ▪ Logs ▪ Info ▪ hooks 47
  • 49. 49 Our Journey Milestone 1 Milestone 2 }Testing Module Commands + POM Framework Milestone 3 Milestone 4
  • 50. 50 Unit Test API Tests UI Tests Publish Postman And Rest Assured Selenium Tests Docker image }sonar Code Quality