際際滷

際際滷Share 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 Cversion
? 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 Call
? - 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 C
?
? 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 Call
? 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)

Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
Himanshu Agrawal
?
Hacking Git and GitHub
Hacking Git and GitHubHacking Git and GitHub
Hacking Git and GitHub
Edureka!
?
GIT & Github introduction for beginners
GIT & Github introduction for  beginnersGIT & Github introduction for  beginners
GIT & Github introduction for beginners
riteshsingh3651
?
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
?
introductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee275640
?
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
?
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Md. Ahsan Habib Nayan
?
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
?
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptxGit & GitHub 101farwsfrwvnfuvnvjvvv.pptx
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
sihoxe6756
?
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
}猟
?
Git Hub Platform
Git Hub PlatformGit Hub Platform
Git Hub Platform
Gaurav Ahluwalia
?
Git and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPBGit and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
SahilSonar4
?
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
Git hub visualstudiocode
Git hub visualstudiocodeGit hub visualstudiocode
Git hub visualstudiocode
Rolands Krumbergs
?
Git github
Git githubGit github
Git github
Anurag Deb
?
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
Ashok Kumar Satuluri
?
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1
?
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
GhadiAlGhosh
?
Hacking Git and GitHub
Hacking Git and GitHubHacking Git and GitHub
Hacking Git and GitHub
Edureka!
?
GIT & Github introduction for beginners
GIT & Github introduction for  beginnersGIT & Github introduction for  beginners
GIT & Github introduction for beginners
riteshsingh3651
?
introductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee275640
?
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptxGit & GitHub 101farwsfrwvnfuvnvjvvv.pptx
Git & GitHub 101farwsfrwvnfuvnvjvvv.pptx
sihoxe6756
?
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
}猟
?
Git and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPBGit and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
SahilSonar4
?
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
?
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1
?
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
GhadiAlGhosh
?

Recently uploaded (20)

OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKEROFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
AdityaSK5
?
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
?
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
?
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
?
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
?
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario
?
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
josephmigliorini1
?
BUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptxBUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptx
greeshmadj0
?
power system protection and why to protect the system
power system protection and why to protect the systempower system protection and why to protect the system
power system protection and why to protect the system
DivyangBhatt6
?
Smart wearable device for for health monitering
Smart wearable device for for health moniteringSmart wearable device for for health monitering
Smart wearable device for for health monitering
Venky1435
?
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
Guru Nanak Technical Institutions
?
iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111
ssuser3c947d
?
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
?
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
yadavchandan322
?
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
?
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
arivazhaganrajangam
?
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
Guru Nanak Technical Institutions
?
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
?
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
?
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Long Vo
?
OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKEROFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
OFFICE AUTOMATION USING ESP32 AND ESP RAINMAKER
AdityaSK5
?
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
?
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
?
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
?
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
?
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario
?
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
Shaping Skylines- The Evolution of Real Estate Development and the Vision of ...
josephmigliorini1
?
BUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptxBUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptx
greeshmadj0
?
power system protection and why to protect the system
power system protection and why to protect the systempower system protection and why to protect the system
power system protection and why to protect the system
DivyangBhatt6
?
Smart wearable device for for health monitering
Smart wearable device for for health moniteringSmart wearable device for for health monitering
Smart wearable device for for health monitering
Venky1435
?
iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111
ssuser3c947d
?
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
?
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
PROJECT REPORT ON PASTA MACHINE - KP AUTOMATIONS - PASTA MAKING MACHINE PROJE...
yadavchandan322
?
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
?
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
arivazhaganrajangam
?
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
?
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
?
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Long Vo
?

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 Cversion ? 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 ^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!
  • 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 Call ? - 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 C ? ? 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 Call ? 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