SlideShare a Scribd company logo
Git
Reuven M. Lerner • reuven@lerner.co.il
       Open Israel Conference
           June 30th, 2011
Who am I?
• Web developer, software architect,
  consultant, lecturer/trainer
• Linux Journal columnist since 1996
• Mostly Ruby on Rails + PostgreSQL, but
  also Python, PHP, jQuery, and lots more...
• Git user (and enthusiast) since 2008
What is
version control?
Time machine

• Return to any point in
  a project’s history
• Find out how files,
  folders have changed
• Learn which user
  made which changes
Backup

• Never fear that you’ve
  deleted a file — just
  rewind the history
• Everything is recorded,
  can be undone
Maintenance tool

• “Tag” releases
• Who is to blame for a particular bug?
• When did we introduce a particular
  problem?
• Deploy specific versions on specific servers
Scratchpad

• Try out new ideas
• Experiment with alternative techniques
• Upgrade a library
• Refactor without affecting the “live” code
  base
Collaboration tool
• Work without fear of
  “stomping” on
  someone else’s code
• Identify conflicts
  between what
  developers wrote
• Mix and match teams
  for projects
Version control is great
• If you’re a programmer and not using
  version control, you’re really missing out
 • It’s also good for non-programs, such as
    configuration files
• If you’re a CTO/team leader/VP R&D and
  your people aren’t using version control,
  you’re inviting disaster
What do people use?
• RCS (ancient history)
• CVS (should be ancient history)
• Subversion (“a better CVS”)
• SourceSafe
• Perforce
• lots of other systems
Problems with these
• Work requires a server connection
 • (You can work, but not commit.)
• Branching and merging is painful and slow
 • So no one does it!
• Enforces a particular workflow
• More code, more developers — slower VC
Distributed version
         control
• Distributed: Everyone is their own server!
• Everyone has a complete commit history
 • No single point of failure
• Commit whenever you want (i.e., often)
• Merge when two repositories connect
Git
• Linus needed a VCS... so he wrote one!
 • Fast
 • Accurate
 • Distributed
 • Massively scalable
 • Super flexible
Open-source Git users
• Linux kernel
• PostgreSQL
• Ruby language
• Ruby on Rails
• Perl language
• among many, many others
Give me details!


• What does Git do that others don’t?
• Why do I claim that Git has changed my
  life?
Branching & merging
• Branching and merging is both easy and fast
  in Git
• I often branch and merge several times in a
  given day
  • When I used SVN, I would do everything
    in my power to avoid branching, because
    merges were long and difficult
Branching & merging
• Create a branch:
 git checkout -b new-branch

• Merge commits from other-branch
 git merge other-branch

• Yes, it’s really that easy.
• You don’t even have to change directories!
Easy branching
   changes everything!
• Every new feature goes in a branch
• Merging becomes easy, fast, and natural
• Side projects are stored, not kept out of
  version control for fear of “contamination”
• Commit, commit, commit all of the time, in
  an appropriate branch — never lose work!
Local repository
         is great
• Work without a network connection
• Commits, merges, and switching branches
  are nearly instantaneous
• Reports and logs are super-fast
 • “Show me all files modified on Tuesday of
    last week” produces immediate resultss
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
Create a repository!
/tmp $ cd myapp
/tmp/myapp $ git init
Initialized empty Git repository in /private/tmp/myapp/.git/
master ✗ /tmp/myapp $ git add .
master ✗ /tmp/myapp $ git commit -a -m 'Initial commit'
[master (root-commit) 030c6b6] Initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
Initial commit


master ✔ /tmp/myapp $
The result

master ✔ /tmp/myapp $ git log

commit 030c6b691993e0f43d78119d9ff1c9e759120d11
Author: Reuven Lerner <reuven@lerner.co.il>
Date:   Thu Jun 30 12:29:29 2011 +0300
    I
Committing in stages

• You can commit all modified files (“git
  commit -a”)
• You can add files to be committed (“git add
  foo.rb”) over time
• Using the staging area gives you
  tremendous flexibility before committing
Remote branches

• A local branch can “track” a remote branch
• Different branches can be on different
  servers — and then you can merge across
  them
• One possible workflow: Read from one
  remote branch, and write to another
Integration
• Git is all small Unix commands
• Easily integrated into text editors, IDEs,
  cron jobs, monitoring, and system tasks
• Example: Continuous integration servers
• Example: Code-analysis tools
• Also: Front ends to SVN and others!
git blame

• Shows the commit, user, and timestamp of
  when each line of a file was changed
• Useful when you want to know who broke
  the build
• Also useful for deflecting blame from
  clients, who think you broke something!
a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   29)
a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   30) #ifdef WIN32
65e806cb (Bruce Momjian     2010-02-26 02:01:40 +0000   31) #define FD_SETSIZE 1024
a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   32) #endif   /* ! WIN32 */
a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   33)
d08741ea (Tom Lane          2001-02-10 02:31:31 +0000   34) #include "postgres_fe.h"
a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   35)
a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   36) #include "libpq-fe.h"
a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    37) #include "libpq/pqsignal.h"
3da0dfb4 (Tatsuo Ishii      2009-08-03 15:18:14 +0000   38) #include "portability/instr_time.h"
a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   39)
d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   40) #include <ctype.h>
d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   41)
a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    42) #ifndef WIN32
a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   43) #include <sys/time.h>
a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   44) #include <unistd.h>
ffda6747 (Tom Lane          2007-09-27 20:39:43 +0000   45) #endif   /* ! WIN32 */
Commit
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   29)
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   30) #ifdef WIN32
 65e806cb (Bruce Momjian     2010-02-26 02:01:40 +0000   31) #define FD_SETSIZE 1024
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   32) #endif   /* ! WIN32 */
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   33)
 d08741ea (Tom Lane          2001-02-10 02:31:31 +0000   34) #include "postgres_fe.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   35)
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   36) #include "libpq-fe.h"
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    37) #include "libpq/pqsignal.h"
 3da0dfb4 (Tatsuo Ishii      2009-08-03 15:18:14 +0000   38) #include "portability/instr_time.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   39)
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   40) #include <ctype.h>
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   41)
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    42) #ifndef WIN32
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   43) #include <sys/time.h>
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   44) #include <unistd.h>
 ffda6747 (Tom Lane          2007-09-27 20:39:43 +0000   45) #endif   /* ! WIN32 */
Commit User
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   29)
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   30) #ifdef WIN32
 65e806cb (Bruce Momjian     2010-02-26 02:01:40 +0000   31) #define FD_SETSIZE 1024
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   32) #endif   /* ! WIN32 */
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   33)
 d08741ea (Tom Lane          2001-02-10 02:31:31 +0000   34) #include "postgres_fe.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   35)
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   36) #include "libpq-fe.h"
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    37) #include "libpq/pqsignal.h"
 3da0dfb4 (Tatsuo Ishii      2009-08-03 15:18:14 +0000   38) #include "portability/instr_time.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   39)
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   40) #include <ctype.h>
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   41)
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    42) #ifndef WIN32
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   43) #include <sys/time.h>
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   44) #include <unistd.h>
 ffda6747 (Tom Lane          2007-09-27 20:39:43 +0000   45) #endif   /* ! WIN32 */
Commit User                     Timestamp
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   29)
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   30) #ifdef WIN32
 65e806cb (Bruce Momjian     2010-02-26 02:01:40 +0000   31) #define FD_SETSIZE 1024
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   32) #endif   /* ! WIN32 */
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   33)
 d08741ea (Tom Lane          2001-02-10 02:31:31 +0000   34) #include "postgres_fe.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   35)
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   36) #include "libpq-fe.h"
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    37) #include "libpq/pqsignal.h"
 3da0dfb4 (Tatsuo Ishii      2009-08-03 15:18:14 +0000   38) #include "portability/instr_time.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   39)
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   40) #include <ctype.h>
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   41)
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    42) #ifndef WIN32
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   43) #include <sys/time.h>
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   44) #include <unistd.h>
 ffda6747 (Tom Lane          2007-09-27 20:39:43 +0000   45) #endif   /* ! WIN32 */
Commit User                     Timestamp                 Line # and code
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   29)
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   30) #ifdef WIN32
 65e806cb (Bruce Momjian     2010-02-26 02:01:40 +0000   31) #define FD_SETSIZE 1024
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   32) #endif   /* ! WIN32 */
 a23c6415 (Magnus Hagander   2009-07-30 09:28:00 +0000   33)
 d08741ea (Tom Lane          2001-02-10 02:31:31 +0000   34) #include "postgres_fe.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   35)
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   36) #include "libpq-fe.h"
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    37) #include "libpq/pqsignal.h"
 3da0dfb4 (Tatsuo Ishii      2009-08-03 15:18:14 +0000   38) #include "portability/instr_time.h"
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   39)
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   40) #include <ctype.h>
 d156e1f8 (Tom Lane          2005-10-07 15:34:17 +0000   41)
 a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000    42) #ifndef WIN32
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   43) #include <sys/time.h>
 a765db40 (Tatsuo Ishii      2000-01-15 12:38:09 +0000   44) #include <unistd.h>
 ffda6747 (Tom Lane          2007-09-27 20:39:43 +0000   45) #endif   /* ! WIN32 */
git bisect
• You introduced a bug, but don’t know
  where? Git can find it!
 • Give two endpoints
 • Git does a binary search between them
 • For each commit, tell Git whether it is
    “good” or “bad”
 • This finds the bug very quickly
Stash
• Temporary storage space
• Useful if you have done enough work to
  keep, but not enough for a commit
• Emergency fixes in the middle of working
  on something else
• If you need, put the stash into a new branch
• Oh, you can have multiple stashes
Hooks
• Execute arbitrary code when things happen
• Example: Update submodules automatically
• Example: Send e-mail after a commit
• Example: Heroku uses hooks to deploy a
  new version of your Web app when you
  push to them!
Workflows

• Git supports many, many workflows
 • Traditional centralized server
 • BDFL and users
 • BDFL and Lieutenants
• Do what works for you!
Traditional




Source: ProGit.org
Integration-manager




Source: ProGit.org
Large, BDFL




Source: ProGit.org
Cherry picking

• You can merge specific
  commits, or parts of
  commits
• Amazingly powerful
Rebase
• An alternative to regular merging
• First merge all external commits, then
  replay your changes on top
• Helps to keep you aligned with remote
  branches
• Avoids some merge-conflict issues
Submodules

• A Git repository can point to other
  repositories — submodules
• Break a project into smaller projects
• Git puts the pieces together for you!
Amending commits
• Commits are not sacred in Git
• Rather, they are a tool to manage history
• Change, amend, and edit commits
• Yes, this can be dangerous!
• Also avoids hundreds of “fixed typo”
  commits in a row...
Commercial hosting

• You can host Git repositories on your own
• Want to go commercial? GitHub,
  Gitorious, and many others work great
• GitHub is free for open-source projects,
  and thus very popular
GUIs

• Yes, there are now GUIs for Git
• Windows, Mac, and Unix versions all exist
• Integration with Emacs and other editors
  for hard-core hacker-nerds
• Also: Shell-prompt integration for Unix
In short
• Git has completely changed how I develop
  code, both alone and with others
• The speed and easy branching/merging are
  game-changers
• It’s really not that hard to start using...
• ... and once you start, you’ll never want to
  go back to CVS or SVN
Want to learn more?
• Mailing lists, wikis, and blogs
 • http://git-scm.com/
 • http://progit.org/
 • http://gitimmersion.com/
• I’m probably going to offer Git training
  soon — let me know if you’re interested!
Thanks!
(Any questions?)
     reuven@lerner.co.il
   http://www.lerner.co.il/
        054-496-8405
“reuvenlerner” on Skype/AIM

More Related Content

What's hot

New Views on your History with git replace
New Views on your History with git replaceNew Views on your History with git replace
New Views on your History with git replace
Christian Couder
 
Working with multiple git repositories
Working with multiple git repositoriesWorking with multiple git repositories
Working with multiple git repositories
Julien Pivotto
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
SV Ruby on Rails Meetup
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
mwrather
 
Hello, Git!
Hello, Git!Hello, Git!
Logstash and friends
Logstash and friendsLogstash and friends
Logstash and friends
Julien Pivotto
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internally
SeongJae Park
 
slides.pdf
slides.pdfslides.pdf
slides.pdfvidsvagi
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
Introduction to Git (part 1)
Introduction to Git (part 1)Introduction to Git (part 1)
Introduction to Git (part 1)
Salvatore Cordiano
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
th507
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Code review and automated testing for Puppet code
Code review and automated testing for Puppet codeCode review and automated testing for Puppet code
Code review and automated testing for Puppet code
wzzrd
 

What's hot (20)

New Views on your History with git replace
New Views on your History with git replaceNew Views on your History with git replace
New Views on your History with git replace
 
Working with multiple git repositories
Working with multiple git repositoriesWorking with multiple git repositories
Working with multiple git repositories
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
Hello, Git!
Hello, Git!Hello, Git!
Hello, Git!
 
Logstash and friends
Logstash and friendsLogstash and friends
Logstash and friends
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internally
 
slides.pdf
slides.pdfslides.pdf
slides.pdf
 
git and github
git and githubgit and github
git and github
 
Introduction to Git (part 1)
Introduction to Git (part 1)Introduction to Git (part 1)
Introduction to Git (part 1)
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Git training v10
Git training v10Git training v10
Git training v10
 
Code review and automated testing for Puppet code
Code review and automated testing for Puppet codeCode review and automated testing for Puppet code
Code review and automated testing for Puppet code
 

Viewers also liked

Big Data — Your new best friend
Big Data — Your new best friendBig Data — Your new best friend
Big Data — Your new best friend
Reuven Lerner
 
PostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conferencePostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conference
Reuven Lerner
 
What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?
Reuven Lerner
 
ActiveRecord 2.3
ActiveRecord 2.3ActiveRecord 2.3
ActiveRecord 2.3
Reuven Lerner
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014
Reuven Lerner
 
Web APIs: The future of software
Web APIs: The future of softwareWeb APIs: The future of software
Web APIs: The future of software
Reuven Lerner
 
Rails console
Rails consoleRails console
Rails console
Reuven Lerner
 
Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship group
Reuven Lerner
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methods
Reuven Lerner
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
Reuven Lerner
 
Technical training business talk.key
Technical training business talk.keyTechnical training business talk.key
Technical training business talk.key
Reuven Lerner
 
Intro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, JerusalemIntro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, Jerusalem
Reuven Lerner
 

Viewers also liked (12)

Big Data — Your new best friend
Big Data — Your new best friendBig Data — Your new best friend
Big Data — Your new best friend
 
PostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conferencePostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conference
 
What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?
 
ActiveRecord 2.3
ActiveRecord 2.3ActiveRecord 2.3
ActiveRecord 2.3
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014
 
Web APIs: The future of software
Web APIs: The future of softwareWeb APIs: The future of software
Web APIs: The future of software
 
Rails console
Rails consoleRails console
Rails console
 
Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship group
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methods
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Technical training business talk.key
Technical training business talk.keyTechnical training business talk.key
Technical training business talk.key
 
Intro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, JerusalemIntro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, Jerusalem
 

Similar to Git talk from Open 2011 conference in Israel

Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with GitThings Lab
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
atishgoswami
 
3 Git
3 Git3 Git
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
Tony Hillerson
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 
Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...
fureigh
 
Geecon11 - Git: a Gentle InTroduction
Geecon11 -  Git: a Gentle InTroductionGeecon11 -  Git: a Gentle InTroduction
Geecon11 - Git: a Gentle InTroduction
Bruno Bossola
 
GIT: a Gentle InTroduction
GIT: a Gentle InTroductionGIT: a Gentle InTroduction
GIT: a Gentle InTroduction
Codemotion
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
PRIYATHAMDARISI
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar
 
Git
GitGit
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Mandi Walls
 
Git - (a) Gentle InTroduction
Git - (a) Gentle InTroductionGit - (a) Gentle InTroduction
Git - (a) Gentle InTroduction
Bruno Bossola
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to Master
C. M. Abdullah Khan
 
Intro to git (UT biocomputing 2015)
Intro to git (UT biocomputing 2015)Intro to git (UT biocomputing 2015)
Intro to git (UT biocomputing 2015)
chenghlee
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 

Similar to Git talk from Open 2011 conference in Israel (20)

Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
3 Git
3 Git3 Git
3 Git
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...
 
Geecon11 - Git: a Gentle InTroduction
Geecon11 -  Git: a Gentle InTroductionGeecon11 -  Git: a Gentle InTroduction
Geecon11 - Git: a Gentle InTroduction
 
GIT: a Gentle InTroduction
GIT: a Gentle InTroductionGIT: a Gentle InTroduction
GIT: a Gentle InTroduction
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git
GitGit
Git
 
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
 
Git - (a) Gentle InTroduction
Git - (a) Gentle InTroductionGit - (a) Gentle InTroduction
Git - (a) Gentle InTroduction
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to Master
 
Intro to git (UT biocomputing 2015)
Intro to git (UT biocomputing 2015)Intro to git (UT biocomputing 2015)
Intro to git (UT biocomputing 2015)
 
Git hub
Git hubGit hub
Git hub
 

More from Reuven Lerner

PostgreSQL, your NoSQL database
PostgreSQL, your NoSQL databasePostgreSQL, your NoSQL database
PostgreSQL, your NoSQL database
Reuven Lerner
 
Rails israel 2013
Rails israel 2013Rails israel 2013
Rails israel 2013
Reuven Lerner
 
Rails traps
Rails trapsRails traps
Rails traps
Reuven Lerner
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Reuven Lerner
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
Reuven Lerner
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Reuven Lerner
 
Ruby objects
Ruby objectsRuby objects
Ruby objects
Reuven Lerner
 
Rails tools
Rails toolsRails tools
Rails tools
Reuven Lerner
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
Reuven Lerner
 

More from Reuven Lerner (9)

PostgreSQL, your NoSQL database
PostgreSQL, your NoSQL databasePostgreSQL, your NoSQL database
PostgreSQL, your NoSQL database
 
Rails israel 2013
Rails israel 2013Rails israel 2013
Rails israel 2013
 
Rails traps
Rails trapsRails traps
Rails traps
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011
 
Ruby objects
Ruby objectsRuby objects
Ruby objects
 
Rails tools
Rails toolsRails tools
Rails tools
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 

Recently uploaded

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 

Recently uploaded (20)

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

Git talk from Open 2011 conference in Israel

  • 1. Git Reuven M. Lerner • reuven@lerner.co.il Open Israel Conference June 30th, 2011
  • 2. Who am I? • Web developer, software architect, consultant, lecturer/trainer • Linux Journal columnist since 1996 • Mostly Ruby on Rails + PostgreSQL, but also Python, PHP, jQuery, and lots more... • Git user (and enthusiast) since 2008
  • 4. Time machine • Return to any point in a project’s history • Find out how files, folders have changed • Learn which user made which changes
  • 5. Backup • Never fear that you’ve deleted a file — just rewind the history • Everything is recorded, can be undone
  • 6. Maintenance tool • “Tag” releases • Who is to blame for a particular bug? • When did we introduce a particular problem? • Deploy specific versions on specific servers
  • 7. Scratchpad • Try out new ideas • Experiment with alternative techniques • Upgrade a library • Refactor without affecting the “live” code base
  • 8. Collaboration tool • Work without fear of “stomping” on someone else’s code • Identify conflicts between what developers wrote • Mix and match teams for projects
  • 9. Version control is great • If you’re a programmer and not using version control, you’re really missing out • It’s also good for non-programs, such as configuration files • If you’re a CTO/team leader/VP R&D and your people aren’t using version control, you’re inviting disaster
  • 10. What do people use? • RCS (ancient history) • CVS (should be ancient history) • Subversion (“a better CVS”) • SourceSafe • Perforce • lots of other systems
  • 11. Problems with these • Work requires a server connection • (You can work, but not commit.) • Branching and merging is painful and slow • So no one does it! • Enforces a particular workflow • More code, more developers — slower VC
  • 12. Distributed version control • Distributed: Everyone is their own server! • Everyone has a complete commit history • No single point of failure • Commit whenever you want (i.e., often) • Merge when two repositories connect
  • 13. Git • Linus needed a VCS... so he wrote one! • Fast • Accurate • Distributed • Massively scalable • Super flexible
  • 14. Open-source Git users • Linux kernel • PostgreSQL • Ruby language • Ruby on Rails • Perl language • among many, many others
  • 15. Give me details! • What does Git do that others don’t? • Why do I claim that Git has changed my life?
  • 16. Branching & merging • Branching and merging is both easy and fast in Git • I often branch and merge several times in a given day • When I used SVN, I would do everything in my power to avoid branching, because merges were long and difficult
  • 17. Branching & merging • Create a branch: git checkout -b new-branch • Merge commits from other-branch git merge other-branch • Yes, it’s really that easy. • You don’t even have to change directories!
  • 18. Easy branching changes everything! • Every new feature goes in a branch • Merging becomes easy, fast, and natural • Side projects are stored, not kept out of version control for fear of “contamination” • Commit, commit, commit all of the time, in an appropriate branch — never lose work!
  • 19. Local repository is great • Work without a network connection • Commits, merges, and switching branches are nearly instantaneous • Reports and logs are super-fast • “Show me all files modified on Tuesday of last week” produces immediate resultss
  • 20. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 21. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 22. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 23. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 24. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 25. Create a repository! /tmp $ cd myapp /tmp/myapp $ git init Initialized empty Git repository in /private/tmp/myapp/.git/ master ✗ /tmp/myapp $ git add . master ✗ /tmp/myapp $ git commit -a -m 'Initial commit' [master (root-commit) 030c6b6] Initial commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo Initial commit master ✔ /tmp/myapp $
  • 26. The result master ✔ /tmp/myapp $ git log commit 030c6b691993e0f43d78119d9ff1c9e759120d11 Author: Reuven Lerner <reuven@lerner.co.il> Date: Thu Jun 30 12:29:29 2011 +0300 I
  • 27. Committing in stages • You can commit all modified files (“git commit -a”) • You can add files to be committed (“git add foo.rb”) over time • Using the staging area gives you tremendous flexibility before committing
  • 28. Remote branches • A local branch can “track” a remote branch • Different branches can be on different servers — and then you can merge across them • One possible workflow: Read from one remote branch, and write to another
  • 29. Integration • Git is all small Unix commands • Easily integrated into text editors, IDEs, cron jobs, monitoring, and system tasks • Example: Continuous integration servers • Example: Code-analysis tools • Also: Front ends to SVN and others!
  • 30. git blame • Shows the commit, user, and timestamp of when each line of a file was changed • Useful when you want to know who broke the build • Also useful for deflecting blame from clients, who think you broke something!
  • 31. a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 29) a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 30) #ifdef WIN32 65e806cb (Bruce Momjian 2010-02-26 02:01:40 +0000 31) #define FD_SETSIZE 1024 a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 32) #endif /* ! WIN32 */ a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 33) d08741ea (Tom Lane 2001-02-10 02:31:31 +0000 34) #include "postgres_fe.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 35) a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 36) #include "libpq-fe.h" a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 37) #include "libpq/pqsignal.h" 3da0dfb4 (Tatsuo Ishii 2009-08-03 15:18:14 +0000 38) #include "portability/instr_time.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 39) d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 40) #include <ctype.h> d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 41) a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 42) #ifndef WIN32 a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 43) #include <sys/time.h> a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 44) #include <unistd.h> ffda6747 (Tom Lane 2007-09-27 20:39:43 +0000 45) #endif /* ! WIN32 */
  • 32. Commit a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 29) a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 30) #ifdef WIN32 65e806cb (Bruce Momjian 2010-02-26 02:01:40 +0000 31) #define FD_SETSIZE 1024 a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 32) #endif /* ! WIN32 */ a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 33) d08741ea (Tom Lane 2001-02-10 02:31:31 +0000 34) #include "postgres_fe.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 35) a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 36) #include "libpq-fe.h" a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 37) #include "libpq/pqsignal.h" 3da0dfb4 (Tatsuo Ishii 2009-08-03 15:18:14 +0000 38) #include "portability/instr_time.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 39) d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 40) #include <ctype.h> d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 41) a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 42) #ifndef WIN32 a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 43) #include <sys/time.h> a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 44) #include <unistd.h> ffda6747 (Tom Lane 2007-09-27 20:39:43 +0000 45) #endif /* ! WIN32 */
  • 33. Commit User a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 29) a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 30) #ifdef WIN32 65e806cb (Bruce Momjian 2010-02-26 02:01:40 +0000 31) #define FD_SETSIZE 1024 a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 32) #endif /* ! WIN32 */ a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 33) d08741ea (Tom Lane 2001-02-10 02:31:31 +0000 34) #include "postgres_fe.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 35) a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 36) #include "libpq-fe.h" a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 37) #include "libpq/pqsignal.h" 3da0dfb4 (Tatsuo Ishii 2009-08-03 15:18:14 +0000 38) #include "portability/instr_time.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 39) d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 40) #include <ctype.h> d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 41) a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 42) #ifndef WIN32 a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 43) #include <sys/time.h> a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 44) #include <unistd.h> ffda6747 (Tom Lane 2007-09-27 20:39:43 +0000 45) #endif /* ! WIN32 */
  • 34. Commit User Timestamp a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 29) a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 30) #ifdef WIN32 65e806cb (Bruce Momjian 2010-02-26 02:01:40 +0000 31) #define FD_SETSIZE 1024 a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 32) #endif /* ! WIN32 */ a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 33) d08741ea (Tom Lane 2001-02-10 02:31:31 +0000 34) #include "postgres_fe.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 35) a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 36) #include "libpq-fe.h" a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 37) #include "libpq/pqsignal.h" 3da0dfb4 (Tatsuo Ishii 2009-08-03 15:18:14 +0000 38) #include "portability/instr_time.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 39) d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 40) #include <ctype.h> d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 41) a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 42) #ifndef WIN32 a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 43) #include <sys/time.h> a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 44) #include <unistd.h> ffda6747 (Tom Lane 2007-09-27 20:39:43 +0000 45) #endif /* ! WIN32 */
  • 35. Commit User Timestamp Line # and code a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 29) a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 30) #ifdef WIN32 65e806cb (Bruce Momjian 2010-02-26 02:01:40 +0000 31) #define FD_SETSIZE 1024 a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 32) #endif /* ! WIN32 */ a23c6415 (Magnus Hagander 2009-07-30 09:28:00 +0000 33) d08741ea (Tom Lane 2001-02-10 02:31:31 +0000 34) #include "postgres_fe.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 35) a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 36) #include "libpq-fe.h" a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 37) #include "libpq/pqsignal.h" 3da0dfb4 (Tatsuo Ishii 2009-08-03 15:18:14 +0000 38) #include "portability/instr_time.h" a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 39) d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 40) #include <ctype.h> d156e1f8 (Tom Lane 2005-10-07 15:34:17 +0000 41) a8a198b1 (Itagaki Takahiro 2010-01-06 01:30:03 +0000 42) #ifndef WIN32 a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 43) #include <sys/time.h> a765db40 (Tatsuo Ishii 2000-01-15 12:38:09 +0000 44) #include <unistd.h> ffda6747 (Tom Lane 2007-09-27 20:39:43 +0000 45) #endif /* ! WIN32 */
  • 36. git bisect • You introduced a bug, but don’t know where? Git can find it! • Give two endpoints • Git does a binary search between them • For each commit, tell Git whether it is “good” or “bad” • This finds the bug very quickly
  • 37. Stash • Temporary storage space • Useful if you have done enough work to keep, but not enough for a commit • Emergency fixes in the middle of working on something else • If you need, put the stash into a new branch • Oh, you can have multiple stashes
  • 38. Hooks • Execute arbitrary code when things happen • Example: Update submodules automatically • Example: Send e-mail after a commit • Example: Heroku uses hooks to deploy a new version of your Web app when you push to them!
  • 39. Workflows • Git supports many, many workflows • Traditional centralized server • BDFL and users • BDFL and Lieutenants • Do what works for you!
  • 43. Cherry picking • You can merge specific commits, or parts of commits • Amazingly powerful
  • 44. Rebase • An alternative to regular merging • First merge all external commits, then replay your changes on top • Helps to keep you aligned with remote branches • Avoids some merge-conflict issues
  • 45. Submodules • A Git repository can point to other repositories — submodules • Break a project into smaller projects • Git puts the pieces together for you!
  • 46. Amending commits • Commits are not sacred in Git • Rather, they are a tool to manage history • Change, amend, and edit commits • Yes, this can be dangerous! • Also avoids hundreds of “fixed typo” commits in a row...
  • 47. Commercial hosting • You can host Git repositories on your own • Want to go commercial? GitHub, Gitorious, and many others work great • GitHub is free for open-source projects, and thus very popular
  • 48.
  • 49. GUIs • Yes, there are now GUIs for Git • Windows, Mac, and Unix versions all exist • Integration with Emacs and other editors for hard-core hacker-nerds • Also: Shell-prompt integration for Unix
  • 50. In short • Git has completely changed how I develop code, both alone and with others • The speed and easy branching/merging are game-changers • It’s really not that hard to start using... • ... and once you start, you’ll never want to go back to CVS or SVN
  • 51. Want to learn more? • Mailing lists, wikis, and blogs • http://git-scm.com/ • http://progit.org/ • http://gitimmersion.com/ • I’m probably going to offer Git training soon — let me know if you’re interested!
  • 52. Thanks! (Any questions?) reuven@lerner.co.il http://www.lerner.co.il/ 054-496-8405 “reuvenlerner” on Skype/AIM

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n