Sie sind auf Seite 1von 16

Electrical and Mechanical Engineering Department

SOFTWARE ENGINEERING DEPARTMENT

MSC IN SOFTWARE ENGINEERING


WEEKEND PROGRAM

Version Control System,


Git and GitHub
By: BELETE ASMARE
Addis Ababa Ethiopia1
Presentation Overview
 Introduction

 Version Control System

 Git and GitHub

 Basic concepts and basic commands of Git

 Basic components and basic commands of


GitHub

 Demo 2
Introduction
 First there was an ad hoc approach (copy dirs)
 Then local version control systems (VCSs)
 Then centralized (means there is a server)
CVS, SVN
 Why version control?

• Makes working in a team easy!


1. Code without interference.
2. Go back to a previous version (iOS 10 anyone?)
3. Integrate code of multiple developer’s easily.
4. Know who did what, when.
• Keep your code secure.
3
Version Control System
 is a software that helps software developers to work together and
maintain a complete history of their work.
 Version control is the management of changes to
documents, primarily computer programs.
Developers can review project history to find out:
 Which changes were made?
 Who made the changes?
 When were the changes made?
 Why were changes needed?
types of VCS:
1. Local Version Control Systems
2. Centralized version control system (CVCS).
3. Distributed/Decentralized version control system (DVCS).
Centralized version control system Distributed/Decentralized version
(CVCS). control system (DVCS)
based on the idea that there is a single takes a peer-to-peer approach to version
“central” copy of your project control, as opposed to the client–server
somewhere (probably on a server), and approach of centralized systems.
programmers will “commit” their
changes to this central copy.
Getting history, doing different tasks There may be many servers
requires the server

So there is some latency No latency (all is local)

They require a network connection to Does not require a network connection to


work on the source code work on the source code,
require network connection only to publish
your changes and take the latest changes.

The VCS server is a single point of Clients have the whole


failure repository

Committing” a change simply means Micro commits possible (two step commit)
recording the change in the central
system.
Example: CVS, Subversion (or SVN) and Example Git , Mercurial , BitKeeper
5
Perforce. Bazaar, Darcs
Git and GitHub
 Git is a DVC tool that is used to store different
versions of a file in a remote or local
repository.
 Git is a specific open-source version control
system created by Linus Torvalds in 2005.
 commonly used for open source and
commercial software development.
 According to a Stack Overflow developer
survey, over 87% of developers use Git.
 Command-Line Tool (accessible with Terminal on the
Mac or Git Bash on Windows)
6
Groups of Git commands
 Setup and branch management
 init, checkout, branch
 Modify
 add, delete, rename, commit
 Get information
 status, diff, log
 Create reference points
 tag, branch
Basic Git concepts
 clone: Clone remote repository (and its full history) to
your computer
 stage: Place a file in the staging area
 commit: Place a file in the git directory (repository)
 push: Update remote repository using local repository
 pull: Update local repository using remote repository
 add: Start tracking a new file, or stage a modified file
 branch: An end point in the commit tree
 fork: A copy of another repository for reuse
 merge: Combine two commits 8
Basic Git Commands
 git init – Initialize a Git repository/working
directory
 git status – Status of your working directory
 git add <filename> or git add . (for all files in your
working directory)
 git commit – Stash changes in your working
directory
 git log –online – View your commit history
 git clone – Create an identical copy
9
Cont..
 git push – push your changes into the remote
repository
 git pull – pull your latest changes from the
remote repository
 git branch – view branches in your repository
 git branch <branchname> - create a branch
 git checkout <branchname> - move to that
branch
 git merge <branchname> - merge into that
branch
 git revert <commit sha> 10
GitHub
 hosting medium/website for your Git
repositories
 Offers powerful collaborative abilities
 A good indicator of what you code/how
much you code/quality of your code
 GitHub is a code hosting platform for version
control and collaboration.
 It lets you and others work together on projects
from anywhere.
11
The difference between Git and GitHub

Git GitHub
a revision control system, a GitHub is a website and cloud-
tool to manage your source based service that helps
code history developers store and manage
their code,
Git for version control and cloud-based Git repository
collaboration. hosting service.
Git client so that can use A good indicator of what you
SSH to pull down your own Git code/how much you
repository from GitHub (or code/quality of your code
other similar services).
work offline most of the time GitHub provides a Web-
based graphical interface.
12
Git is a command line tool,
Basic components of GitHub
1. A repository is usually used to organize a single
project that can contain folders and files, images,
videos, spreadsheets, and data sets
2. Branching is the way to work on different versions
of a repository at one time.
3. commit :On GitHub, saved changes are
called commits.
4. Pull Requests is heart of collaboration on GitHub.
proposing changes and requesting that someone
review and pull in contribution and merge them into
their branch
5. Merge your Pull Request: it's time to bring
changes together – merging created branch into
the master branch. 13
Some basic Terminology
 git = the shell command to work with Git
 repo = Repository, where the code for a
given project is kept
 commit = verb, means push the code to the
server (in Git, commit = (commit + push)
 diff = the difference between two versions of
a file
 SSH = Secure SHell – Network protocol for
communication between machines
 RSA = Rivest, Shamir, Adleman – public-key
cryptography algorithm
14
Demo GitHub

15
16

Das könnte Ihnen auch gefallen