Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Git 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Source Code Management /

Version Control System


27-Jun(r) 28-Jun(v2) 29-Jun(v3)

mag. fg mag. fg mag. fg

u
u u

m r
m

mail. mail.
was
I.cfg Ag Ag
plugin-cL plugin-cL
Version Control System
Version control is a system that allows the software team to manage changes to the source code over time
This software tool makes it easier for developers to collaborate on different projects separating their tasks through
branches
It also gives the possibility to turn back to earlier versions for comparing and fixing the mistakes if needed
Version Control Systems (VCS) also known as SCM (Source Code Management) or RCS (Revision Control System) are
software tools for keeping track of changes to the source code over time

⑧ code files -> (data)

② changes database - Creta data).


Benefits
Long-term change history
The changes made by developers, including the creating, modification, and deletion of files over the years, can be seen in history
It will allow going back to the previous version for analyzing bugs and fixing problems
Branching and merging

Merging brings the works together and allows seeing if there are conflicts between those works
Traceability
Ability to trace each change and connect it to project management and bug tracking software, as well as to annotate each change
with a message describing the purpose of the change
Synchronization
The up-to-date codes can be fetched from the repository
Backup and Restore
Files are saved at any time and restored from the last saved one
Undoing
You can undo both the last known version and the last one created a long time ago
Branching and Merging
Changes are made on a branch and after being approved, they can be merged with the master branch
Types
Local Version Control System
Local VCSs were created to prevent issues like confusing
the directories and accidentally writing or copying to the
wrong file
It is a simple database that keeps all the changes to files
under revision control files
Repositary
*

db
One of the most popular VCS tools was a system called
Revision Control System (RCS), which is still distributed
today, although being an earlier version control system ·de met
dat
It allows users to make their revisions of a document,
commit changes, and merge them. RCS was originally
developed for programs but is also useful for text
documents or configuration files that are frequently revised

e.g. dated
Centralized Version Control System S
Sever

In centralized systems, all the versioned files, as well as a files


number of clients that check out files from that central db
& SPOF
place, are included in a single server
·de
-

For many years, this has been the standard for version
met
dat
7
control M

Centralized Version Control Systems are CVS, Subversion, n


and Perforce -out
wel
amwit
e.g. SVM, Source Safe, ...

C
C
Dev 3
Dev Dev 2

W
u u L ↓ u

Xu u u
Distributed Version Control System Sever

In Distributed Version Control Systems (DVCS), clients fully files


db

-
mirror the repository, including its full history
If the server that these systems were collaborating with
water meta

(1)
dies, the client repositories can be copied back up to the
server to restore it
Distributed Version Control Systems are Git, Mercurial,
Bazaar or Darcs
e.g. GIT,
Mercurial, devi devs
---

alsde yesdere
files

·de
Git
What is Git ?
Git is a distributed revision control and source code management system
Git was initially designed and developed by Linus Torvalds for Linux kernel development
Git is a free software distributed under the terms of the GNU General Public License version 2
History
The Linux kernel is an open source software project of very large scope
From 1991 2002, changes to the software were passed around as patches and archived files
In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper
In 2005, the relationship with BitKeeper broken down and -of-charge status was revoked
-of-charge status was revoked (and in particular Linus Torvalds) to develop their own tool based on some of the
lessons they learned while using BitKeeper
Some of the goals of the new system were
Speed
Simple design ↓branching
Strong support for non-linear development (thousands of parallel branches)
Fully distributed
Able to handle large projects like the Linux kernel efficiently (speed and data size)
Characteristics
Strong support for non-linear development
Distributed development
Compatibility with existent systems and protocols
Efficient handling of large projects
Cryptographic authentication of history
Toolkit-based design
Pluggable merge strategies
Advantages
Free and open source
Fast and small
Implicit backup
Security
No need of powerful hardware
Easier branching
Basic Workflow
sudo install git
install
Ubuntu
-> apt
a install.
windows install is download gitbash
git config
The git config command is a function that sets configuration variables
It controls git look and operation
Levels
Local (--local)
When no configuration option is passed git config writes to a local level, by default
The repository of the .git directory has a file that stores local configuration values
Global (--global)
The application of the global level configuration includes the operating system user
Global configuration values can be found in a file placed in a user's home directory
System (--system)
The System-level configuration includes all users on an operating system and all repositories
System-level configuration file is located in a git config file of the system root path
git init
The git init command is used to generate a new, empty Git repository or to reinitialize an existing one
With the help of this command, a .git subdirectory is created, which includes the metadata, like subdirectories for objects
and template files, needed for generating a new Git repository
Working Staging repositary
aver
directory
git westere file
file staged file
--

git db
w git add commit

I file - m

file
w
file we

w
u
w
u
u

:
u

S
N
<Campane) R

git diff git log


git checkout
git add
The git add is a command, which adds changes in the working directory to the staging area
With the help of this command, you tell Git that you want to add updates to a certain file in the next commit
But in order to record changes, you need to run git commit too
In combination with the commands mentioned above, git status command is also needed to see which state the working
directory and the staging area are in
git commit
The git commit command saves all currently staged changes of the project
Commits are created to capture the current state of a project
Committed snapshots are considered safe versions of a project because Git asks before changing them
Before running git commit command, git add command is used to promote changes to the project that will be then stored in
a commit
Working of commit
Git snapshots are committed to the local repository
Git creates an opportunity to gather the commits in the local repository, rather than making a change and commit it immediately to
the central repository
This has many advantages splitting up a feature into commits, grouping the related commits, and cleaning up local history before
committing it to the central repository
This also gives the developers an opportunity to work in an isolated manner
git log
The git log command shows committed snapshots
It is used for listing and filtering the project history, and searching for particular changes
The git log only works on the committed history in comparison with git status controlling the working directory and the
staging area
working directory staging area repository
git westere file
file staged file
--

reset
9 it
w git commit db

git add file - m

file
I w
file we

w
u
w
u

in
u
u

A
N
<Campane) R
git log
git diff
git checkout W

git reset hard


--
THANK YOU!
SUNBEAM INFOTECH

You might also like