0% found this document useful (0 votes)
29 views25 pages

Git Work

The document provides an overview of version control and version control systems (VCS), specifically focusing on Git, a distributed VCS created by Linus Torvalds in 2005. It outlines key features of Git, including its architecture, the process of creating repositories, staging and committing changes, branching, merging, and collaboration with remote repositories. Additionally, it explains commands for managing files and changes within Git, emphasizing its role in software development.

Uploaded by

ndolikenny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views25 pages

Git Work

The document provides an overview of version control and version control systems (VCS), specifically focusing on Git, a distributed VCS created by Linus Torvalds in 2005. It outlines key features of Git, including its architecture, the process of creating repositories, staging and committing changes, branching, merging, and collaboration with remote repositories. Additionally, it explains commands for managing files and changes within Git, emphasizing its role in software development.

Uploaded by

ndolikenny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Group 1

Presentation
Version control and Version control
systems(VCS)
• Version control, also known as source control, is the
practice of tracking and managing changes to software
code

• Version control systems are software tools that help


software teams manage changes to source code over
time.

Example: git, SVN (Subversion), Mercurial


What is Git

Git is a distributed version control system (VCS) that

helps manage and track changes to source code during

software development. It was created by Linus Torvalds in

2005 and has become one of the most widely used

version control systems.


Here are some key aspects and
features of Git

• Distributed System: Unlike centralized version control

systems, Git is distributed. Each developer has a

complete copy of the entire repository, including the

entire history of changes. This decentralization allows

for more flexibility and collaboration.


Cont’

• Repository: A Git repository is a collection of files and

directories, along with the entire history of changes

made to those files. Repositories can be local (on a

developer's machine) or remote (on a server), and

developers can clone, push, and pull changes between


How to create a new Git
repository
1.Create a new folder for your project.
2.Open the folder in Git BASH.
3.Issue the git init command to create the new Git repo.
4.Note the creation of the hidden .git folder in the
project.
5.Add files and folders to your project.
6.Routinely stage files and create commits.
Cont’

• Commits: In Git, changes are tracked through commits.

A commit is a snapshot of the entire repository at a

specific point in time. Each commit is identified by a

unique hash, and it includes information about the

changes made, the author, and a timestamp.


Cont’

• Branching: Git encourages the use of branches to

isolate changes and development efforts. Developers

can create branches to work on specific features or fixes

without affecting the main codebase. Branches can be

easily merged, allowing for a more organized and


Cont’

• Merging: Merging is the process of combining changes

from different branches into a single branch. Git

automatically handles most merges, but conflicts may

arise when changes


Cont’

• Security: Git uses cryptographic hashes to ensure the

integrity of the repository. Each commit is identified by

a unique SHA-1 hash, and any changes to the repository

content will result in a different hash.


Git architecture
• Three-tree architecture in Git:

1. The working directory: containing changes that may


not be tracked by Git,
2. The staging index: contains changes that are ready
to be committed into the repository,
3. The repository: changes are being tracked by Git
Architecture
Working directory

• Working copy is the place where you make your changes. Whenever

you edit something, it is saved in working copy and it is a physically

stored in a disk.
Staging area
The staging area stores information about what will go into your next commit

• Adding files to staging area

• Run the following command in terminal (Git Bash, CMD, Power


Shell)

• 1. Staging single file:


• Git add file.html, index.php

• 2. Staging all files:


• Git add .

• 3. Staging all files of the same extension:


• Git add .*html
Git repository
• Repository is the place where all the version of the files or commits,
logs etc is stored. It is also saved in a disk and has its own set of files.

• Commiting files:

• Git commit –m “commit message”


How does Git works
• Initialization:

To start using Git in a project, you need to initialize a Git repository. This

is done by running the ‘git init’ command in the project's root directory.

This creates a hidden subfolder within the project that houses the

internal data structure required for version control.


cont’
• Staging Changes:

As you make changes to your project files, Git monitors and

tracks these changes. Before committing them, you can choose

which changes to include in the next commit by staging them.

The staging area (or index) is a space where you prepare your

changes before making a commit.


Cont’
• Committing:

Once you're satisfied with the changes in the staging area, you

commit them to the Git repository. A commit is a snapshot of

the project at a specific point in time, containing information

about the changes made, the author, and a pointer to the

previous commit.
Cont’
• Branching:

Git allows for branching, which involves creating a separate line

of development. This is useful for working on new features or

bug fixes without affecting the main codebase. Branches are

lightweight and can be easily merged back into the main

branch when the changes are ready.


Cont’
• Merging:

When a branch is ready to be integrated into the main

codebase, you merge it. Git automatically merges changes if

they don't conflict. If there are conflicts (i.e., changes in the

same file that cannot be automatically reconciled), you'll need

to resolve them manually.


Cont’
• Remote Repositories:

Git supports collaboration by allowing developers to work on their local copies

of a repository and then synchronize their changes with a remote repository

(e.g., on GitHub, GitLab, Bitbucket). This is done using commands like ‘git

push’ (sending changes to the remote repository) and ‘git pull’ (retrieving

changes from the remote repository).


Cont’

• Clone:

When starting to work on an existing project, you can

clone a remote repository to create a local copy on your

machine. This establishes a connection between your

local repository and the remote repository.


Cont’
• Fetch and Pull:

To update your local repository with changes from a remote repository,

you use ‘git fetch’ to retrieve the changes without automatically

merging them into your working directory. If you want to fetch and

merge in one step, you can use ‘git pull’.


Cont’

• Push:

To share your local commits with others, you push them to a remote

repository using the ‘git push’ command. This makes your changes

available for collaboration.


Cont’

• Tagging:

Git allows you to create tags, which are references to

specific points in history. Tags are often used to mark

release points or important milestones in the project.

You might also like