2. Introduction
Many Beginners still think Git is a trouble!!!!
This slide is to introduce you to GIT and how it’s beneficial in managing our
project.
GIT originally developed in 2005 by Linus Torvalds, the famous creator of the
Linux operating system kernel.
3. What you will learn
What is Git
Basic Git Terminology & Common GIT Operations
Git vs GitHub
Create Your First Git Local Repository & push it to GitHub
5. What is Git?
One of the primary things that Git does and also the primary reason it exists is to
keep track of the entire history of things that you are working on.
Simply, Git is like a person👤 who observes your code & remember what you &
your teammate changed, when you changed it & why you changed it.
He (Git) simply keep track of changes!
6. Basic Git Terminology - 1
Repository
Now imagine this person keep these changes for each project in different
folders📁.
This Folder is called a repository
Commit, Every Time you change something in your project you can tell
(commit) that person (Git) to remember it with unique ID, so he can tell you
about that change in the future if you need.
7. Basic Git Terminology - 2
Branch
For convenience, he keeps these records in a different cabinet, called branch. In
the beginning, there is only one slot called master branch you can tell him to add
more!
8. Git Operations
Init-> To initialize a local directory as Git repository
Push -> To upload changes to your repository
Pull -> To download any version of a file from a repository
Clone -> To clone a remote Git repository (GitHub) to a local machine
10. What is GitHub
GitHub is a platform (an online service) that provides hosting for your projects, it
is called a remote repository because it's on a remote server.
GitHub is also called a remote repository
Git is local (tool) but GitHub is online service
12. GitHub Ranking
As of January 2020, GitHub reports having over 40 million users and more than
100 million repositories (including at least 28 million public repositories), making
it the largest host of source code in the world.
GitHub is not the only option! other choices include Git Lab and
Bitbucket.
13. Create your First Git local repository - 1
Create a sample folder 📁named ‘Demo’ and place some sample code files in it.
Create a GitHub Account
If you don't have one you can open an account it is available freely over the
internet 👉 https://github.com/
14. Create your First Git local repository - 2
Make sure you have Git installed on your machine
You can install Git for Windows which provides a BASH emulation used to run Git
from the command line. Personally, I like running Git from the command line, but
it also provides the Git GUI, a powerful alternative to Git BASH.
https://gitforwindows.org/
15. Create your First Git local repository - 3
Tell Git who you are
$ git config --global user.name "YOUR_USERNAME"
$ git config --global user.email "YOUREMAIL@domain.com"
$ git config --global --list # To check the info you just provided
16. Create your First Git local repository - 4
Let’s Git
Create a new repository on GitHub.
Follow the below link:
https://github.com/new.
Now, locate to the folder you want to place under git in your PC.
$ cd Desktop/Demo
17. Create your First Git local repository - 5
Initialize Git:
$ touch README.md # To create a README file
$ git init # Initiates an empty git repository
now you have successfully created a Git local repository
18. Add files for commit
Add the files to the Git repository for commit:
$ git add . # Adds all the files in the local repository and stages them for commit
Commit files you added to your Git repo:
$ git commit -m "First commit"# The message in the " " is given so that the other
users can read the message and see what changes you made
19. Add a remote origin and Push - 1
Now each time you make changes in your files and save it, it won’t be
automatically updated on GitHub. All the changes we made in the file are
updated in the local repository. Now to update the changes to the master:
$ git remote add origin remote_repository_URL# sets the new remote
The git remote command lets you create, view, and delete connections to other
repositories.
20. Add a remote origin and Push - 2
$ git push -u origin master # pushes changes to origin
Now the git push command pushes the changes in your local repository up to
the remote repository you specified as the origin.
And that’s it. You’ve just added the files to the repository you just created on
GitHub.
21. Q&A
For Any inquires feel free to send me an email at
ghadialghosh[@]outlook.com
Thank You