Git training for sysadmins

(or, how to tolerate and even benefit from git)

Panu Kalliokoski, 16.1.2015

Preliminaries

git - the stupid content tracker

( man git ) Well, not stupid, actually quite smart (in an artificial intelligence-ish way), but…

→ no way would this come so far if it wasn't for Linus' personal support!

Git's good sides

That said… - git's evolving really fast

Centralised and distributed version control

but, in practice, usually one repository works as a sync repo in DVCS too… so what's the difference?
  1. you can commit without publishing
  2. you can form independent sub-teams

How to get going with git

Pretty simple! Either:

Basic git workflow

  1. git pull --ff-only — bring your local working directory up-to-date
  2. edit files etc. in an ordinary way
    • git add file.txt — tell git about a new file to be tracked
  3. make a commit out of a logical set of changes
    • git commit -am description — commit all new work
    • git add -p; git commit — commit only some part
  4. repeat from (2) if you don't want to publish your changes yet
  5. git pull --rebase — merge your work with what others have been doing
  6. git push — publish your work to your remote repository
  7. go home.

First hands-on

Working with others

In case of conflicts, short version

Making sure you don't have anything going on

Second hands-on

Git's internal objects

git pitää kirjaa myös ainakin:

And now we revert to URL-clicking…

How to use version control in sysadmin work?

at least three ways:

  1. prod-system local checkouts
  2. dev-system checkout and publish-automation script
  3. dev-system checkout, packaging and install-automation script

Should I use branches for differentiation between machines?

no, parameterization is almost always better