This document provides an overview of Git and GitHub. It describes Git as a version control system that allows developers to track changes to files, revert to previous versions, and collaborate on projects. Key Git commands are explained, such as initializing a repository, adding files, committing changes, and checking out different versions. The document also distinguishes between Git, which is installed locally, and GitHub, which hosts repositories in the cloud and allows sharing projects.
2. Agenda
Version Control System
What is GIT
GIT Most Common Command
Difference between Git and Github
Clone project from Github
3. Version Control System
A version control system is a software that tracks changes to a file or set of
files over time so that you can recall specific versions later.
Developers can compare earlier versions of the code with an older version to
fix the mistakes.
4. What is Git
Git is a version control system
It’s a Local Repo
It is used for:
• Tracking code changes
• Tracking who made changes
• Coding collaboration
5. Why Git?
• Over 70% of developers use Git!
• Developers can work together from anywhere in the world.
• Developers can see the full history of the project.
• Developers can revert to earlier versions of a project
6. Git Command
git –-version
Configure Git
Now let Git know who you are. This is important for version control systems, as
each Git commit uses this information:
git config --global user.name "w3schools-test"
git config --global user.email "test@w3schools.com
7.
8. Initialize Git
Once you have navigated to the correct folder, you can initialize Git on that
folder
git init
Initialized empty Git repository in /Users/user/myproject/.git/
10. Git Staging Environment
Staged files are untracked files. Staging area is a files that are going to be a
part of the next commit.
git add sum.java
If multiple file needs to be staged
git add –all / git add .
The file should be Staged. Let's check the status::
git status
11.
12.
13. Git Commit
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.
git commit -m "First release of Hello World!“
14. Git Log
To view the history of commits for a repository, you can use the log command:
git log
15. I will add one more java class and
commit again
16.
17.
18. How to move from one commit to another commit (Currently we have 4 java file
in second commit and 3 file in first commit)
Now move to first commit
Git checkout 64ebd846e00778006e9a0e9e4522c9f2bd2e36e6
28. Difference Between Git and Github
Git is an open-source tool developers install locally to manage source code
while GitHub is an online service to which developers who use Git can
connect and upload or download resources
29. Clone Project from github
A clone is a full copy of a repository, including all logging and versions of files.
git clone https://github.com/shashirajraja/shopping-cart.git