git

Advantages over SVN
 
 

VERSION CONTROL SYSTEM (VCS)

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

ADVANTAGES OF USING A VCS

  • Review changes made over time

We can read the history of a single file to understand how it evolved from the beginning

ADVANTAGES OF USING A VCS

  • See who last modified something that might be causing a problem... and blame him!

Type of VCS

Centralized VCS

(svn)

Nay

Single point of failure

Requires internet connection

Slow (commit)

Very slow (revision graph)

Decentralized VCS

(git)

Yay

Every clone is a fork

Every clone is a backup

No connectivity issues

Fast. Really!

 

Nay

Not good for large binary files (use git-lfs!)

Git design goals

  • Speed
  • Simple design
  • Strong support for thousands of parallel branches
  • Fully distributed
  • Able to handle larges projects like Linux kernel effectively
  • Ensure integrity

Tracking Changes

(SVN)
  • A basic version of the file is saved
  • Any modification to that file is saved separately
  • When we want to retrieve a specific version of the project, all the single modifications are applied to the basic file, for all the file in the repository

Advantages

Space efficient
 

Disadvantages

Time inefficient

Tracking Snapshots

(git)
  • A whole copy of a file is done when this is modified
  • When we want to retrieve a specific version of the project, we just copy to the tree structure corresponding to that version in the working directory

Advantages

Extremely time efficient

 

Disadvantages

Space "inefficient"

..but it's not a problem if we mostly track text based files

Git advantages

Nearly every operation is local

  • Operations are very fast
  • Every local repository is a backup
  • No need of internet connection to work
    (only needed to synchronize occasionally)

Git has integrity

  • Everything is checksummed
  • References are SHA-1



24b9da6552252987aa493b52f8696cd6d3b00373

Git doesn't delete

  • Git generally only adds data
  • If you mess up, you can usually recover your stuff
  • Recovery can be tricky though (in some cases)
 
 

WORKFLOW

SVN Single branch

Once a modification is committed, it is in production and shared with everyone else.

PROBLEMS

  • If you commit unfinished modifications:
    • they end up in production and can break things
  • If you wait to finish the modification:
    • you may end up making a huge, difficult to understand commit
    • no checkpoints while working on it, so difficult to experiment and rollback
  • Difficult to review what others made before committing to production

PROBLEMS

  • Cannot identify commits belonging to the same feature
  • Cannot compare changes of my feature spread over multiple commits to the latest
  • Need to make a new clone of the repo if I need to work on something else in parallel
  • Need to lock files to avoid conflicts (madness!)

SVN Multi branch

Text

PROBLEMS

  • Each branch in its own folder
    • mess up other sofware (e.g. eclipse)
  • No clear review mechanism

GIT

ADVANTAGES

  • Branches are easy to create
    • A new branch for each feature, bug, ...
  • Branches are local
    • Can commit partial changes, amend, rebase, experiment and only at the end send my modifications
  • Switching branch changes the content of the current working directory.
    • Can work on dozens of things in parallel

ADVANTAGES

  • Pull requests
    • Auto-test changes
    • Auto-lint changes
    • Changes can (and should) be reviewed before merging to production
    • Dedicate interface to review changes by multiple people

ADVANTAGES

  • Conflicts are minimal
    • Only if same lines changed
  • No need to lock files to work

ONE FLOW

 

 

https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow

Requirments for success

  • Discipline of the developers
    • Write good commit messages
    • A branch for each feature/bug
    • Perform code reviews
    • Do not merge broken code

Requirments for success

  • Enforced policies/workflow
    • Decide a git workflow and stick to it
      (write it in a document)
    • Train people on git best practices
      • not that hard

ADVANTAGES for the company

  • Code Review > Higher  code quality > Less bugs (and customer care)
  • Small local commits > Easier to experiment and revert code > Higher efficiency of developers
  • No internet connection > Fast operations and work anywhere > Higher efficiency of developers
  • Auto-testing and merge block > Higher  code quality (nothing broken in production!)
  • Auto-deployment > Less work spent on repetitive, error-prone tasks

Git - Advantages over SVN

By Simone Gaiarin

Git - Advantages over SVN

VCS, git, file status life cycle

  • 266