SlideShare a Scribd company logo
1 of 19
 Called Version Control System(VCS) or Source Code Manager (SCM)
 software tools that help a developer team manage changes to source code over time.
 keeps track of every modification to the code in a special kind of database.
 If a mistake is made developers can turn back the clock and compare earlier versions of the code to help fix.
 Version Control Systems Types :-
 Local Version Control Systems.
 Centralized Version Control Systems.
 Distributed Version Control Systems
What is Version Control Systems ?
 Contain multiple repositories.
 Each user has their own repository and working copy.
 Each user has the entire repository on their computer.
 Advantages :-
 No central server
.
 Fully mirror the repository, including its full history.
 Every clone is really a full backup of all the data.
 Examples :[ Git , Mercurial ]
Distributed Version Control Systems
# What is
Intro to Git
Git are :
 Distributed version control system.
 Free and open source Tool.
 Developed by Linus Torvalds in April 2005 to mange Linux Kernel Changes.
 Command Line tool developers install it locally in Laptop or Desktop .
 For tracking changes in source code during software development.
 Running on OS (Windows ,Linux ,Unix ,Mac).
 Git can work as a standalone program as a server and as a client
 Git website https://git-scm.com/
 We chose Git for its popularity, multi platform support and robust set of features.
Git Workflow
Open the Link of video
https://youtu.be/pNP7CAa6chc
Git Workflow 2
Open the Link of video
https://youtu.be/5Adofl7gre4
 Repository (repo): A directory that contains your project work, as well as a few files (hidden by default in Mac OS X)
which are used to communicate with Git. Repositories can exist either locally on your computer or as a remote copy on
another computer.
 Commit (snapshot): Git thinks of its data like a set of snapshots of a mini file system. Every time you commit, or save
the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a
reference to that snapshot.
 Working Directory: The files that you see in your computer's file system. When you open your project files up on a code
editor, you're working with files in the Working Directory.
When working with Git,the Working Directoryis also different from the command line's concept of the current working directorywhich is the
directorythat your shell is "looking at" right now.
Git Keywords
 Staging Area or Staging Index or Index: Afile in the Git directory that stores information about what will go into your next
commit. You can think of the staging area as a prep table where Git will take the next commit. Files on the Staging Index
are poised to be added to the repository.
 SHA: A SHA is basically an ID number for each commit. It is a 40-character string composed of characters (0–9 and a–f) and
calculated based on the contents of a file or directory structure in Git. "SHA" is shorthand for "SHA hash". ASHA might look
like this: E2adf8ae3e2e4ed40add75cc44cf9d0a869afeb
Git Keywords
How to Install Git ?
 T
o download Git:
1 Frist Check already installation by go to cmd & write git --version
2 go to https://git-scm.com/downloads
3 download the software for Windows.
4 install Git choosing all of the default options.
Once everything is installed, you should be able to run git on the command line. If it displays the usage information,
then you're good to go!
If you run into any issues, please remember to take advantage of Knowledge and the community in your Study Group.
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Git cheat sheet – Create Repo
git config
Setting Basic Git
Configuration
# sets up Gitwith youremail
git config --global user.email "<your-email-address>“
# makes sure thatGitoutputis colored
git config --global color.ui auto
# displays the original state in a conflict
git config --global merge.conflictstyle diff3 git config --list
 Before you can start using Git, you need to configure it. Run each of the following lines on the command line to make sure
everything is set up.
# sets up Gitwith yourname
git config --global user.name "<Your-Full-Name>“
Git cheat sheet – General Commands
 Before you can make commits or do anything else with a git repository, the repository needs to actually exist. To
create a new repository with Git ,we'll use the git init command.
# Required Commands
Heads up! We'll be using the following terminal commands in this lesson:
 ls :used to list files and directories.
 mkdir:used to create a new directory.
 touch :used to create a new file
 cp :used to copies the content of file file1 into file file2.
 cd :used to change directories.
 rm :used to remove files and directories.
 pwd:used to print the working directory.
Git cheat sheet – Create Repo
git init
git init
Running the creates a hidden directory.
This directory is the brain/storage center for the repository.
It holds all of the configuration files and directories and is where all of the commits are stored.
Create empty Git repo in
specified directory.
git init .git
.git
(notice the . at the beginning - that means it'll be a hidden directory on Mac/Linux).
W
ARNING:-
Don't directly edit any files inside the .git directory. This is the heart of the repository.
If you change file names and/or file content, git will probably lose track of the files
that you're keeping in the repo, and you could lose a lot of work! It's okay to look at
those files though, but don't edit or delete them.
Git cheat sheet – Create Repo
git clone
Copy existing repos from
somewhere else to your
local Computer
 Verify T
erminal Location
TIP: Now before you clone anything, make sure you are located in the correct
directory on the command line. Cloning a project creates a new directory and
places the cloned Git repository in it. The problem is that you can't have nested Git
repositories. So make sure the terminal's current working directory isn't located in
a Git repository. If your current working directory is not in your shell's prompt,
type pwd to print the working directory.
 This command:
takes the path to an existing repository.
by default will create a directory with the same name as the repository that's
being cloned.
can be given a second argument that will be used as the name of the directory.
will create the new repository inside of the current working directory.
git clone D:git-coursecourse-git-blog-project
git clone https://github.com/haithmak/course-git-project
Git cheat sheet – Repo History
git log
Display information about
the existing commits
git show
Display information about
the given commit
git log
git log --stat
git log --oneline
git log --patch
git show
git show --oneline fdf5493
git show fdf5493
git show -w fdf5493
Git cheat sheet – Add ,Commit to Repo
git add
Move files from the
Working Directory to
the Staging Index
git diff
see changes that have
been made but haven't
been committed, yet
git add index.html
git add .
git add css/app.css js/app.js
git commit
takes files from the
Staging Index and
saves them in the
repository
git commit index.html
git commit -m "Initial commit"
git diff
git status
Check the status of
Repo & List which files
are staged, unstaged ,
and untracked
git status
Having Git Ignore Files
 Git Ignore
Add .gitignore file to your project in the same directory that the hidden .git directory is located. All you have to do is list the names
of files that you want Git to ignore (not track) and it will ignore them.
 Globbing lets you use special characters to match patterns/characters. In the .gitignore file, you can use the following:
 blank lines can be used for spacing
 # - marks line as a comment
 * - matches 0 or more characters
 ? - matches 1 character
 [abc] - matches a, b, _or_ c
 ** - matches nested directories - a/**/z matches
•a/z
•a/b/z
•a/b/c/z
 Let's try it with the "project.docx" file.Add the following line inside the .gitignore file:
 project.docx
Now run git status and check its output.
Git GUI

More Related Content

Similar to 1-Intro to VC & GIT PDF.pptx

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 for developers
Git for developersGit for developers
Git for developersHacen Dadda
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdfAliaaTarek5
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITPouriaQashqai1
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - WorkflowTahsin Abrar
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting StartedWildan Maulana
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxAbelPhilipJoseph
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answersDeepQuest Software
 

Similar to 1-Intro to VC & GIT PDF.pptx (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?
 
Git Series - Part 1
Git Series - Part 1 Git Series - Part 1
Git Series - Part 1
 
Git
GitGit
Git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Git for developers
Git for developersGit for developers
Git for developers
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answers
 

Recently uploaded

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Recently uploaded (20)

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

1-Intro to VC & GIT PDF.pptx

  • 1.
  • 2.
  • 3.  Called Version Control System(VCS) or Source Code Manager (SCM)  software tools that help a developer team manage changes to source code over time.  keeps track of every modification to the code in a special kind of database.  If a mistake is made developers can turn back the clock and compare earlier versions of the code to help fix.  Version Control Systems Types :-  Local Version Control Systems.  Centralized Version Control Systems.  Distributed Version Control Systems What is Version Control Systems ?
  • 4.  Contain multiple repositories.  Each user has their own repository and working copy.  Each user has the entire repository on their computer.  Advantages :-  No central server .  Fully mirror the repository, including its full history.  Every clone is really a full backup of all the data.  Examples :[ Git , Mercurial ] Distributed Version Control Systems
  • 6. Intro to Git Git are :  Distributed version control system.  Free and open source Tool.  Developed by Linus Torvalds in April 2005 to mange Linux Kernel Changes.  Command Line tool developers install it locally in Laptop or Desktop .  For tracking changes in source code during software development.  Running on OS (Windows ,Linux ,Unix ,Mac).  Git can work as a standalone program as a server and as a client  Git website https://git-scm.com/  We chose Git for its popularity, multi platform support and robust set of features.
  • 7. Git Workflow Open the Link of video https://youtu.be/pNP7CAa6chc
  • 8. Git Workflow 2 Open the Link of video https://youtu.be/5Adofl7gre4
  • 9.  Repository (repo): A directory that contains your project work, as well as a few files (hidden by default in Mac OS X) which are used to communicate with Git. Repositories can exist either locally on your computer or as a remote copy on another computer.  Commit (snapshot): Git thinks of its data like a set of snapshots of a mini file system. Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.  Working Directory: The files that you see in your computer's file system. When you open your project files up on a code editor, you're working with files in the Working Directory. When working with Git,the Working Directoryis also different from the command line's concept of the current working directorywhich is the directorythat your shell is "looking at" right now. Git Keywords
  • 10.  Staging Area or Staging Index or Index: Afile in the Git directory that stores information about what will go into your next commit. You can think of the staging area as a prep table where Git will take the next commit. Files on the Staging Index are poised to be added to the repository.  SHA: A SHA is basically an ID number for each commit. It is a 40-character string composed of characters (0–9 and a–f) and calculated based on the contents of a file or directory structure in Git. "SHA" is shorthand for "SHA hash". ASHA might look like this: E2adf8ae3e2e4ed40add75cc44cf9d0a869afeb Git Keywords
  • 11. How to Install Git ?  T o download Git: 1 Frist Check already installation by go to cmd & write git --version 2 go to https://git-scm.com/downloads 3 download the software for Windows. 4 install Git choosing all of the default options. Once everything is installed, you should be able to run git on the command line. If it displays the usage information, then you're good to go! If you run into any issues, please remember to take advantage of Knowledge and the community in your Study Group. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
  • 12. Git cheat sheet – Create Repo git config Setting Basic Git Configuration # sets up Gitwith youremail git config --global user.email "<your-email-address>“ # makes sure thatGitoutputis colored git config --global color.ui auto # displays the original state in a conflict git config --global merge.conflictstyle diff3 git config --list  Before you can start using Git, you need to configure it. Run each of the following lines on the command line to make sure everything is set up. # sets up Gitwith yourname git config --global user.name "<Your-Full-Name>“
  • 13. Git cheat sheet – General Commands  Before you can make commits or do anything else with a git repository, the repository needs to actually exist. To create a new repository with Git ,we'll use the git init command. # Required Commands Heads up! We'll be using the following terminal commands in this lesson:  ls :used to list files and directories.  mkdir:used to create a new directory.  touch :used to create a new file  cp :used to copies the content of file file1 into file file2.  cd :used to change directories.  rm :used to remove files and directories.  pwd:used to print the working directory.
  • 14. Git cheat sheet – Create Repo git init git init Running the creates a hidden directory. This directory is the brain/storage center for the repository. It holds all of the configuration files and directories and is where all of the commits are stored. Create empty Git repo in specified directory. git init .git .git (notice the . at the beginning - that means it'll be a hidden directory on Mac/Linux). W ARNING:- Don't directly edit any files inside the .git directory. This is the heart of the repository. If you change file names and/or file content, git will probably lose track of the files that you're keeping in the repo, and you could lose a lot of work! It's okay to look at those files though, but don't edit or delete them.
  • 15. Git cheat sheet – Create Repo git clone Copy existing repos from somewhere else to your local Computer  Verify T erminal Location TIP: Now before you clone anything, make sure you are located in the correct directory on the command line. Cloning a project creates a new directory and places the cloned Git repository in it. The problem is that you can't have nested Git repositories. So make sure the terminal's current working directory isn't located in a Git repository. If your current working directory is not in your shell's prompt, type pwd to print the working directory.  This command: takes the path to an existing repository. by default will create a directory with the same name as the repository that's being cloned. can be given a second argument that will be used as the name of the directory. will create the new repository inside of the current working directory. git clone D:git-coursecourse-git-blog-project git clone https://github.com/haithmak/course-git-project
  • 16. Git cheat sheet – Repo History git log Display information about the existing commits git show Display information about the given commit git log git log --stat git log --oneline git log --patch git show git show --oneline fdf5493 git show fdf5493 git show -w fdf5493
  • 17. Git cheat sheet – Add ,Commit to Repo git add Move files from the Working Directory to the Staging Index git diff see changes that have been made but haven't been committed, yet git add index.html git add . git add css/app.css js/app.js git commit takes files from the Staging Index and saves them in the repository git commit index.html git commit -m "Initial commit" git diff git status Check the status of Repo & List which files are staged, unstaged , and untracked git status
  • 18. Having Git Ignore Files  Git Ignore Add .gitignore file to your project in the same directory that the hidden .git directory is located. All you have to do is list the names of files that you want Git to ignore (not track) and it will ignore them.  Globbing lets you use special characters to match patterns/characters. In the .gitignore file, you can use the following:  blank lines can be used for spacing  # - marks line as a comment  * - matches 0 or more characters  ? - matches 1 character  [abc] - matches a, b, _or_ c  ** - matches nested directories - a/**/z matches •a/z •a/b/z •a/b/c/z  Let's try it with the "project.docx" file.Add the following line inside the .gitignore file:  project.docx Now run git status and check its output.