Links from the talk:

* Git homepage

* Msysgit (Git for Windows)

* GitExtensions (Wraps Git for Windows + Visual studio + more niceness)

* Github

* Gitblit (the windows friendly repository manager)

* Git for Human Beings mailing list where I hang out

* German Git book

* The free book online

Other links

* Git Cheat Sheet: http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html

* German Cheat Sheet: https://github.com/esc/git-cheatsheet-de/blob/master/cheatsheet.pdf

Before I start, let me give you the TLDR version:

Main Goal today: show you how Git works

Act 1: Show cmd-line action

Act 2: git internals

Act 3: Pushing around, merging

Getting started with Git, super easy

  1. Init repo
  2. Add a readme.txt
  3. Stage, commit it
  4. Show log
  5. Commit another
  6. Commit amend

Again, this time with feeling (git internals)

Git commands

  1. Remove the .git folder
  2. init
  1. show in explorer what happened (.git folder)
  2. hooks (like commit hooks)
  3. info (configure excluded files)
  4. objects (empty)
  5. refs (practically empty)
  1. The repo still has no objects, so we’ll add the readme file
  1. Showing status before and after, stage it
  2. Show the object file (but don’t go too much into it)
  3. Add it to the index - show the created index file
  1. commit (only the .gitignore)
  2. Have a look at objects (commit, tree and blob)
  1. Explain trees: git show --pretty=raw commit
  2. Note the commit itself, the tree, and the file.
  3. Explain objects: show object creation with git hash-object -w [file]
  4. Create two dirs with one empty file, show they have the same sha

Branching and merging

  1. branch
  1. Create and check out a branch “branding”
  2. Commit some CSS
  3. Apply the stash
  1. checkout (switch, revert)
  1. Back to master
  2. Create another branch: “about”, commit something
  1. merge
  1. Merge “branding” back, no problem
  2. Merge “about” back, notice the merge commit
  1. Show git log
  1. --oneline --decorate --graph

Remote repositories

  1. Clone to another dir
  2. Push to github if possible

About my setup

Note that I use Console2, nothing fancy, it’s just a wrapper around the normal cmd line.

Set shell to be: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe

and home to be c:\Users\tfnico

posh git

for some extra flair: https://github.com/dahlbyk/posh-git

* cinst poshgit - this gives us nice state display, still a bit laggy. I’ll leave it out for now, but you might want to use this in your daily work, if you prefer cmd line.

To reset the ps1, see

C:\Users\tfnico\Documents\WindowsPowerShell\...

Remote repositories

Why even have a central repository in a DVCS?

Github

Internet Explorer: Log in as tfnico-123

Create a repo “bonnagile”, with initial commit. Clone it over https.

Use manual smart https auth 

Store username/password in $HOME/_netrc

Be careful with this file though, don’t think special chars in PW’s are allowed.

machine github.com

login tfnico-123

password bonnagile

Note the warning we get about config default push branches.

Do we have time to show off SSH right away?

Fork one of tfnico’s repos (guava)

Make a push request.

Gitblit

Awfully easy to set up. Just download, change the http port in the properties config, and start it:

C:\tools\gitblit\gitblit-0.9.3> .\gitblit.cmd

http://localhost:8080/

Create repo

Set auth on view and push

Store username and password in ~/_netrc

machine localhost

login tfnico

password bonnagile

Bonus part: SSH

Using SSH keys instead of smart-http username/password make sense for many reasons, but it’s kinda exotic for Windows users. The big minus with http is that you have to store the PW in cleartext on your machine (but hey, who cares).

We’ve already Installed putty along with Git Extensions (for ssh).

In order to make it work with normal Windows command line, you have to set the environment variable GIT_SSH to point at c:\program files (x86)\gitextensions\putty\plink.exe).

Have a look at Github’s help page for more hints: http://help.github.com/ssh-issues/

Bonus part: GIt-SVN

git svn clone -s http://svn2.assembla.com/svn/peekr/

Teardown (to restart the demo)

Remove gitblit repos

Uninstall putty

Uninstall git

Uninstall kdiff

Remove ~/keys

Remove github repo

Remove github keys

Delete ~/_netrc

Delete ~/.gitconfig

Delete bonnagile project (also from github)

Remove c:\backup bare repos

Remove ps1 stuff in C:\Users\tfnico\Documents\WindowsPowerShell\...

Questions for discussion

Any war stories?

In a recent article, evolving agile over 50 months, one change included going from SVN to Git.

Seems they recently switched from doing feature branches, back into single branch. Why?

Does Git make you more agile? Or to put it another way: Does Git enable any typical agile principles or values?

Do you need Git to do Kanban?