git github PPT_GDSCIIITK.pptx
- 3. Git - Downloading Package (git-scm.com)
INSTALLATION GUIDE
Windows User ?? Oh ! Or is it MACOS ??
Git - Downloading Package (git-scm.com)
Well , if it’s Linux / Unix --
UBUNTU : sudo apt install git
OR
FEDORA : sudo yum install git
- 6. Local Version Control System
A local copy is created in my own computer .
All versions are stored in folder , sub-folders or
A database. That’s the user’s choice.
But what if I want to collaborate with people ??
Or what if my computer stops working ??
- 7. Centralised Version Control System (CVCS)
A Centralized Version Control System , Here
we have a server and a client. The server is
the master repository that contains all of the
versions of the code. To work on any
project, firstly user or client needs to get the
code from the master repository or server.
So the client communicates with the server
and pulls all the code or current version of
the code from the server to their local
machine.
- 8. Distributed Version Control System (DVCS)
In distributed version control most of
the mechanism or model applies the
same as centralized. The only major
difference you will find here is, instead
of one single repository which is the
server, here every single developer or
client has their own server and they will
have a copy of the entire history or
version of the code and all of its
branches in their local server or
machine.
- 9. Git and Github
There are many words to define git, but it is an open-source distributed version control
system in simpler words.
Why is git needed?
When a team works on real-life projects, git helps ensure no code conflicts between the
developers. Furthermore, the project requirements change often. So a git manages all
the versions. If needed, we can also go back to the original code. The concept of
branching allows several projects to run in the same codebase.
GitHub is a Git repository hosting service that provides a web-based graphical interface.
It is the largest community in the world. Whenever a project is open-source, that
particular repository gains exposure to the public and invites several people to
contribute.
- 12. Git commands
Here is a list of most essential Git commands that are used daily.
1.Git config commandd
2.Git clone command
3.Git add command
4.Git commit command
5.Git status command
6.Git push Command
7.Git pull command
8.Git Branch Command
9.Git Merge Command
10.Git log command
But there are many more commands..Let’s start…!
- 13. For new git users
Git supports a command called git config that lets you get and set configuration
variables that control all facets of how Git looks and operates.
$ git config --global user.name “GDSC IIIT KOTTAYAM“
$ git config --global user.email “gdsc@iiitkottayam.ac.in"
You can check your configuration settings :
$ git config -list
- 14. Git init
The git init command is the first command that you will run on Git. The git init command
is used to create a new blank repository. It is used to make an existing project as a Git
project.
$ git init
Example :
- 15. Git Status
We can list all the untracked files by git status command.
$ git status
- 16. Git add
The git add command is used to add file contents to the index (Staging area) .This
command updates the current content of the working tree to the staging area. It also
prepares the staged content for the next commit. Every time we add or update any file in
our project, it is required to forward updates to the staging area.
$ git add <File name>
- 22. Git Commit
It is used to record the changes in the repository. It is the next command after the git
add. Every commit contains the index data and the commit message.
Commits are the snapshots of the project. Every commit is recorded in the master
branch of the repository. We can recall the commits or revert it to the older version. Two
different commits will never overwrite because each commit has its own commit-id. This
commit-id is a cryptographic number created by SHA (Secure Hash
Algorithm) algorithm.
$ git commit -m <Commiting Message>
- 23. Git clone
In Git, cloning is the act of making a copy of any target repository. The target repository
can be remote or local. You can clone your repository from the remote repository to
create a local copy on your system.
$ git clone <repository URL>
- 24. Git ignore
In Git, the term "ignore" is used to specify intentionally untracked files that Git should ignore.
It doesn't affect the Files that already tracked by Git. The file system of Git is classified into
three categories:
Tracked:
Tracked files are such files that are previously staged or committed.
Untracked:
Untracked files are such files that are not previously staged or committed.
Ignored:
Ignored files are such files that are explicitly ignored by git. We have to tell git to ignore such
files.
$ touch .gitignore
- 25. Git Fork
A fork is a rough copy of a repository. Forking a repository allows you to freely test and
debug with changes without affecting the original project.
the forked repository looks like pune2016/GitExample2. At the bottom of the repository
name, we can see a description of the repository. At the top right corner, the option fork is
increased by 1 number.
- 26. Git Push
The push term refers to upload local repository content to a remote repository. Pushing
is an act of transfer commits from your local repository to a remote repository. Pushing is
capable of overwriting changes; caution should be taken when pushing.
- 27. Git pull
The term pull is used to receive data from
GitHub. It fetches and merges changes from
the remote server to your working directory.
The git pull command is used to pull a
repository.
Pull request is a process for a developer to
notify team members that they have
completed a feature. Once their feature
branch is ready, the developer files a pull
request via their remote server account. Pull
request announces all the team members
that they need to review the code and
merge it into the master branch.
$ git pull
- 28. Git merge
In Git, the merging is a procedure to connect the forked history. It joins two or more
development history together.
Generally, git merge is used to combine two branches.
$ git merge <branchname>
- 29. Merge conflicts
When two branches are trying to merge, and both are edited at the same time and in the
same file, Git won't be able to identify which version is to take for changes. Such a
situation is called merge conflict. If such a situation occurs, it stops just before the merge
commit so that you can resolve the conflicts manually.