SlideShare a Scribd company logo
Git and Github.pptx
 Git is used to store the source code for a project and track the
complete history of all changes to that code. It allows developers to
collaborate on a project more effectively by providing tools for
managing possibly conflicting changes from multiple developers.
 Git Install
 You can download Git for free from the following
website: https://www.git-scm.com/
 Using Git with Command Line
 To start using Git, we are first going to open up our Command
shell.
 For Windows, you can use Git bash, which comes included in
Git for Windows. For Mac and Linux you can use the built-in
terminal.
 The first thing we need to do, is to check if Git is properly
installed:
 Example
 git –version
 git version 2.30.2.windows.1
 If Git is installed, it should show something like git version X.Y
 git config --global user.name "Hitesh“
 git config --global user.email
“hjha03144@gmail.com”
 Creating Git Folder
 Now, let's create a new folder for our project:
 Example
 mkdir myproject
 cd myproject
 mkdir makes a new directory.
 cd changes the current working directory.
 Now that we are in the correct directory. We can
start by initializing Git!
 If you are having trouble remembering
commands or options for commands, you can
use Git help.
 There are a couple of different ways you can
use the help command in command line:
 git command -help
 - See all the available options for the specific
command
 git help –all
 - See all possible commands
 Let's go over the different commands.
Once you have navigated to the correct
folder, you can initialize Git on that folder:
Example
git init
 Initialized empty Git repository in
/Users/user/myproject/.git/ You just created
your first Git Repository!
 You just created your first local Git repo. But it is
empty.
 Fort this folder I’m creating simple any coding file using
any text editor
 Using System
 Using namespace std
 {
 Class Git{
 Public static void Main(string[]args)
 {
 Console.WriteLine(“This is the first file in my Git repo”);
}
}
}
 And save it to our new folder as Git.cs
 Example
 ls
 Git.cs
 ls will list the files in the directory. We can see that Git.cs is there.
 Then we check the Git status and see if it is a part of our repo:
 Example
 git status
 On branch master
 No commits yetUntracked files:
 (use "git add ..." to include in what will be committed)
 Git.csnothing added to commit but untracked files present (use "git add" to track)
 Now Git is aware of the file, but has not added it to our repository!
 Files in your Git repository folder can be in one of 2 states:
 Tracked
 Untracked –

 When you first add files to an empty repository, they are all untracked. To get Git to track
them, you need to stage them, or add them to the staging environment.
 One of the core functions of Git is the concepts of the Staging Environment,
and the Commit.
 As you are working, you may be adding, editing and removing files. But
whenever you hit a milestone or finish a part of the work, you should add the
files to a Staging Environment.
 Staged files are files that are ready to be committed to the repository you
are working on. You will learn more about commit shortly.
 For now, we are done working with Git.cs. So we can add it to the Staging
Environment:
 Example
 git add Git.cs
 The file should be Staged. Let's check the status::

 Example
 git status
 On branch master
 No commits
 yetChanges to be committed:
 (use "git rm --cached ..." to unstage)
 new file: Git.cs
 You can also stage more than one file at a time. Let's add 2 more files to our working folder.
Use the text editor again.
 A README.md file that describes the repository (recommended for all repositories):

This repository is built step by step in the tutorial.
 Using System
 Using namespace std
 {
 Class Git
 {
 Public static void Main(string[]args)
 {
 Console.WriteLine(“This is the first file in my Git repo”);
Console.WriteLine(“I’ve added one more file or else I should
say I will updated in my file”);
 }
 }
 }
 Example
 git add –all
 Using --all instead of individual filenames will stage all changes (new, modified, and
deleted) files
 Example
 git status
 Since we have finished our work, we are ready
move from stage to commit for our repo.
 When we commit, we should always include
a message.

 Example
 git commit -m "First release of Hello World!“
 [master (root-commit) 221ec6e]
 First release of Hello World!
 The commit command performs a commit,
 and the -m "message" adds a message.
 GitHub is a web-based version-control and
collaboration platform for software developers.
 Microsoft, the biggest single contributor to GitHub.
 Git is not the same as GitHub.
 GitHub makes tools that use Git.

 Three important terms used by developers in
GitHub are fork, pull request and merge
GitHub makes tools that use Git.
GitHub is the largest host of source code in the world, and
has been owned by Microsoft since 2018.
Now that you have made a GitHub
account, sign in, and create a new Repo:
After Creating Repository you will see
interface like this shown below :-
 After Creating the repository fill all the relevant details like name of the
repository and making it as public or private then adding the Readme file for
documentation
 Since we have already set up a local Git repo, we are going to push that to GitHub:

 Copy the URL, or click the clipboard marked in the image above.
 Now paste it the following command:
 Example
 git remote add origin https://github.com/Dark2003fire/hello-world.git
 git remote add origin URL
 specifies that you are adding a remote repository, with the specified URL, as an origin to your local Git repo.
Now we are going to push our master branch to the origin url, and set it as the default remote branch:
 git push --set-upstream origin master
 Since this is the first time you are connecting to GitHub, you will get some kind of notification you to authenticate this connection.

 Now, go back into GitHub and see that the repository has been updated:

 When working as a team on a project, it is important that everyone stays up to date.
 Any time you start working on a project, you should get the most recent changes to your local
copy.
 With Git, you can do that with pull.
 pull is a combination of 2 different commands:
 fetch
 merge
 Let's take a closer look into how fetch, merge, and pull works.
 Git Fetch
 fetch gets all the change history of a tracked branch/repo.
 So, on your local Git, fetch updates to see what has changed on GitHub:
 git fetch origin
 Now that we have the recent changes, we can check our status:
 Example
 git status
 On branch master
 Your branch is behind 'origin/master' by 1 commit, and can be fast-
forwarded. (use "git pull" to update your local branch) nothing to
commit, working tree clean
 git log origin/master
 That looks as expected, but we can also verify by showing the
differences between our local master and origin/master:
 Example
 git diff origin/master
 That looks precisely as expected! Now we can safely merge.
 merge combines the current branch, with a specified branch.
 We have confirmed that the updates are as expected, and we can merge our current
branch (master) with origin/master:
 git merge origin/master
 Check our status again to confirm we are up to date:
 Example
 git status
 But what if you just want to update your local repository, without going through all
those steps?
 pull is a combination of fetch and merge. It is used to pull all changes from a remote
repository into the branch you are working on.Use pull to update our local Git:
git pull origin
 Let's try making some changes to our local git and pushing
them to GitHub.
 Example
 git commit -a -m "Updated Git.cs
 Resized image"
 And check the status:
 Example
 git status
 On branch masterY
 our branch is ahead of 'origin/master' by 1 commit.
 (use "git push" to publish your local commits)
 nothing to commit, working tree clean
 git push origin
 Go to GitHub, and confirm that the repository has a new
commit:
 On GitHub, access your repository and click the "master" branch button.
 There you can create a new Branch. Type in a descriptive name, and click
Create branch:
Selecting a created branch from the github
and working with that as hown below
We can do modifications and updation in
the existing repository and then we can do
the changes we require it is shown below
After doing modifications and updating the
file we are ready to commit the changes
 # git Commands to add the whole project into GitHub
 Steps :--->
 1) git init
 2) git Status
 3) git add .
 4) git commit -m "Initial Commit"
 5) git status (if anything is Present then again use (Git add
.) command)
 6) git remote add origin here u will add that repository
SSH link copy from there and paste it here
 7) git push origin master
 8) git status

More Related Content

Similar to Git and Github.pptx (20)

PPTX
Extra bit with git
Himanshu Agrawal
 
PPTX
Hacking Git and GitHub
Edureka!
 
PPTX
GIT & Github introduction for beginners
riteshsingh3651
 
PPTX
Git & Github
Aman Lalpuria
 
PPTX
git & git hub course in information retrieval .pptx
AmirHosseinGhasemi9
 
PDF
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee275640
 
PPTX
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
PPTX
Git and GitHub
Md. Ahsan Habib Nayan
 
PPTX
Git & GitLab
Gaurav Wable
 
PPTX
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
sihoxe6756
 
PDF
Brief tutorial on Git
聖文 鄭
 
PDF
Git Hub Platform
Gaurav Ahluwalia
 
PPTX
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
PPTX
Beginner's guide to git and github
SahilSonar4
 
PPTX
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
PPTX
Git hub visualstudiocode
Rolands Krumbergs
 
DOCX
Git github
Anurag Deb
 
PPTX
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
DOCX
setting up a repository using GIT
Ashok Kumar Satuluri
 
PPTX
Introduction to git and Github
Wycliff1
 
Extra bit with git
Himanshu Agrawal
 
Hacking Git and GitHub
Edureka!
 
GIT & Github introduction for beginners
riteshsingh3651
 
Git & Github
Aman Lalpuria
 
git & git hub course in information retrieval .pptx
AmirHosseinGhasemi9
 
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee275640
 
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Git and GitHub
Md. Ahsan Habib Nayan
 
Git & GitLab
Gaurav Wable
 
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
sihoxe6756
 
Brief tutorial on Git
聖文 鄭
 
Git Hub Platform
Gaurav Ahluwalia
 
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Beginner's guide to git and github
SahilSonar4
 
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Git hub visualstudiocode
Rolands Krumbergs
 
Git github
Anurag Deb
 
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
setting up a repository using GIT
Ashok Kumar Satuluri
 
Introduction to git and Github
Wycliff1
 

Recently uploaded (20)

PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
smart lot access control system with eye
rasabzahra
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPTX
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
PPTX
Big Data and Data Science hype .pptx
SUNEEL37
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
PPTX
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
smart lot access control system with eye
rasabzahra
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
Big Data and Data Science hype .pptx
SUNEEL37
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
Design Thinking basics for Engineers.pdf
CMR University
 
Ad

Git and Github.pptx

  • 2.  Git is used to store the source code for a project and track the complete history of all changes to that code. It allows developers to collaborate on a project more effectively by providing tools for managing possibly conflicting changes from multiple developers.
  • 3.  Git Install  You can download Git for free from the following website: https://www.git-scm.com/  Using Git with Command Line  To start using Git, we are first going to open up our Command shell.  For Windows, you can use Git bash, which comes included in Git for Windows. For Mac and Linux you can use the built-in terminal.  The first thing we need to do, is to check if Git is properly installed:  Example  git –version  git version 2.30.2.windows.1  If Git is installed, it should show something like git version X.Y
  • 4.  git config --global user.name "Hitesh“  git config --global user.email “[email protected]”  Creating Git Folder  Now, let's create a new folder for our project:  Example  mkdir myproject  cd myproject  mkdir makes a new directory.  cd changes the current working directory.  Now that we are in the correct directory. We can start by initializing Git!
  • 5.  If you are having trouble remembering commands or options for commands, you can use Git help.  There are a couple of different ways you can use the help command in command line:  git command -help  - See all the available options for the specific command  git help –all  - See all possible commands  Let's go over the different commands.
  • 6. Once you have navigated to the correct folder, you can initialize Git on that folder: Example git init  Initialized empty Git repository in /Users/user/myproject/.git/ You just created your first Git Repository!
  • 7.  You just created your first local Git repo. But it is empty.  Fort this folder I’m creating simple any coding file using any text editor  Using System  Using namespace std  {  Class Git{  Public static void Main(string[]args)  {  Console.WriteLine(“This is the first file in my Git repo”); } } }
  • 8.  And save it to our new folder as Git.cs  Example  ls  Git.cs  ls will list the files in the directory. We can see that Git.cs is there.  Then we check the Git status and see if it is a part of our repo:  Example  git status  On branch master  No commits yetUntracked files:  (use "git add ..." to include in what will be committed)  Git.csnothing added to commit but untracked files present (use "git add" to track)  Now Git is aware of the file, but has not added it to our repository!  Files in your Git repository folder can be in one of 2 states:  Tracked  Untracked –   When you first add files to an empty repository, they are all untracked. To get Git to track them, you need to stage them, or add them to the staging environment.
  • 9.  One of the core functions of Git is the concepts of the Staging Environment, and the Commit.  As you are working, you may be adding, editing and removing files. But whenever you hit a milestone or finish a part of the work, you should add the files to a Staging Environment.  Staged files are files that are ready to be committed to the repository you are working on. You will learn more about commit shortly.  For now, we are done working with Git.cs. So we can add it to the Staging Environment:  Example  git add Git.cs  The file should be Staged. Let's check the status::   Example  git status  On branch master  No commits  yetChanges to be committed:  (use "git rm --cached ..." to unstage)  new file: Git.cs
  • 10.  You can also stage more than one file at a time. Let's add 2 more files to our working folder. Use the text editor again.  A README.md file that describes the repository (recommended for all repositories):  This repository is built step by step in the tutorial.  Using System  Using namespace std  {  Class Git  {  Public static void Main(string[]args)  {  Console.WriteLine(“This is the first file in my Git repo”); Console.WriteLine(“I’ve added one more file or else I should say I will updated in my file”);  }  }  }  Example  git add –all  Using --all instead of individual filenames will stage all changes (new, modified, and deleted) files  Example  git status
  • 11.  Since we have finished our work, we are ready move from stage to commit for our repo.  When we commit, we should always include a message.   Example  git commit -m "First release of Hello World!“  [master (root-commit) 221ec6e]  First release of Hello World!  The commit command performs a commit,  and the -m "message" adds a message.
  • 12.  GitHub is a web-based version-control and collaboration platform for software developers.  Microsoft, the biggest single contributor to GitHub.  Git is not the same as GitHub.  GitHub makes tools that use Git.   Three important terms used by developers in GitHub are fork, pull request and merge
  • 13. GitHub makes tools that use Git. GitHub is the largest host of source code in the world, and has been owned by Microsoft since 2018.
  • 14. Now that you have made a GitHub account, sign in, and create a new Repo: After Creating Repository you will see interface like this shown below :-
  • 15.  After Creating the repository fill all the relevant details like name of the repository and making it as public or private then adding the Readme file for documentation
  • 16.  Since we have already set up a local Git repo, we are going to push that to GitHub:   Copy the URL, or click the clipboard marked in the image above.  Now paste it the following command:  Example  git remote add origin https://github.com/Dark2003fire/hello-world.git  git remote add origin URL  specifies that you are adding a remote repository, with the specified URL, as an origin to your local Git repo. Now we are going to push our master branch to the origin url, and set it as the default remote branch:  git push --set-upstream origin master  Since this is the first time you are connecting to GitHub, you will get some kind of notification you to authenticate this connection.   Now, go back into GitHub and see that the repository has been updated: 
  • 17.  When working as a team on a project, it is important that everyone stays up to date.  Any time you start working on a project, you should get the most recent changes to your local copy.  With Git, you can do that with pull.  pull is a combination of 2 different commands:  fetch  merge  Let's take a closer look into how fetch, merge, and pull works.  Git Fetch  fetch gets all the change history of a tracked branch/repo.  So, on your local Git, fetch updates to see what has changed on GitHub:
  • 18.  git fetch origin  Now that we have the recent changes, we can check our status:  Example  git status  On branch master  Your branch is behind 'origin/master' by 1 commit, and can be fast- forwarded. (use "git pull" to update your local branch) nothing to commit, working tree clean  git log origin/master  That looks as expected, but we can also verify by showing the differences between our local master and origin/master:  Example  git diff origin/master  That looks precisely as expected! Now we can safely merge.
  • 19.  merge combines the current branch, with a specified branch.  We have confirmed that the updates are as expected, and we can merge our current branch (master) with origin/master:  git merge origin/master  Check our status again to confirm we are up to date:  Example  git status
  • 20.  But what if you just want to update your local repository, without going through all those steps?  pull is a combination of fetch and merge. It is used to pull all changes from a remote repository into the branch you are working on.Use pull to update our local Git: git pull origin
  • 21.  Let's try making some changes to our local git and pushing them to GitHub.  Example  git commit -a -m "Updated Git.cs  Resized image"  And check the status:  Example  git status  On branch masterY  our branch is ahead of 'origin/master' by 1 commit.  (use "git push" to publish your local commits)  nothing to commit, working tree clean  git push origin  Go to GitHub, and confirm that the repository has a new commit:
  • 22.  On GitHub, access your repository and click the "master" branch button.  There you can create a new Branch. Type in a descriptive name, and click Create branch:
  • 23. Selecting a created branch from the github and working with that as hown below
  • 24. We can do modifications and updation in the existing repository and then we can do the changes we require it is shown below
  • 25. After doing modifications and updating the file we are ready to commit the changes
  • 26.  # git Commands to add the whole project into GitHub  Steps :--->  1) git init  2) git Status  3) git add .  4) git commit -m "Initial Commit"  5) git status (if anything is Present then again use (Git add .) command)  6) git remote add origin here u will add that repository SSH link copy from there and paste it here  7) git push origin master  8) git status