42
Andrzej Grzesik Konrad Malawski LunarLogicPolska

Effective Git

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Effective Git

Andrzej Grzesik Konrad Malawski LunarLogicPolska

Page 2: Effective Git
Page 3: Effective Git
Page 4: Effective Git

Ask them right away!

Page 5: Effective Git

a distributed open source version control system

Page 6: Effective Git

is also fast reliable powerful popular

Page 7: Effective Git
Page 8: Effective Git

•  it is too new •  not tested •  does not provide backups (sic!) •  does not like windows •  does not support ... •  it's not subversion

Page 9: Effective Git

Git is "simple" but hard. Subversion is "easy", but eventually complex.

Thomas Nicolaisen (http://blog.tfnico.com/2011/11/some-thoughts-on-git-vs-complexity.html)

Page 10: Effective Git

git config --global user.name Sheldon Cooper git config --global user.email [email protected] git config --global color.ui true

Page 11: Effective Git
Page 12: Effective Git
Page 13: Effective Git

•  cherry-pick •  rebase (interactive) •  interactive add •  submodules •  git svn •  git sh

Page 14: Effective Git
Page 15: Effective Git
Page 16: Effective Git
Page 17: Effective Git
Page 18: Effective Git

# initialize a submodule git submodule add git://llp.pl/common.git common

# initial pull of it's contents git submodule init

# pull pointed to commit (and overwrite your changes) git submodule update

Page 19: Effective Git
Page 20: Effective Git

cd common

git pull

cd ..

# Warning! Add the dir without trailing "/” git add common

git commit -m "Latest common submodule commit"

Page 21: Effective Git
Page 22: Effective Git
Page 23: Effective Git

... or "Why merge isn't enough?"

Page 24: Effective Git
Page 25: Effective Git
Page 26: Effective Git
Page 27: Effective Git
Page 28: Effective Git
Page 29: Effective Git
Page 30: Effective Git
Page 31: Effective Git
Page 32: Effective Git

https://github.com/ktoso/maven-git-commit-id-plugin

Page 33: Effective Git

Keeping commit info in UI of the running app, results in better (or less!) bug reports :-)

Page 34: Effective Git

{ "branch" : "testing-maven-git-plugin", "commitTime" : "06.01.1970 @ 16:16:26 CET", "commitId" : "787e39f61f99110e74deed68ab9093088d64b969", "commitIdAbbrev" : "787e39f", "commitUserName" : "Konrad Malawski", "commitUserEmail" : "[email protected]", "commitMessageFull" : "releasing my fun plugin :-) + fixed some typos + cleaned up directory structure + added license etc", "commitMessageShort" : "releasing my fun plugin :-)", "buildTime" : "06.01.1970 @ 16:17:53 CET", "buildUserName" : "Konrad Malawski", "buildUserEmail" : "[email protected]" }

Or expose full details, for developers only

@Inject GitRepositoryState repoState;

@GET @Path("/git") public GitRepositoryState getRepoState() { return repoState; }

Page 35: Effective Git
Page 36: Effective Git

De facto standard of viewing git-based repositories

Just point it to the repo

Works through Apache and CGI

Page 37: Effective Git

simple, read/write permissions per-repository

ssh-key based authentication

but it's trivial to expose config file via f.ex. Grails frontend

Page 38: Effective Git

online code review (like ReviewBoard, but better ;-))

also hosts git repositories review commits before they enter a branch

Page 39: Effective Git

    with some help         by the power of Jenkins,              allows to have pre-tested commits

Page 40: Effective Git
Page 41: Effective Git
Page 42: Effective Git

Git immersion: http://library.edgecase.com/git_immersion/index.html

On branching with Git http://nvie.com/posts/a-successful-git-branching-model/

Pro Git book (creative commons) www.progit.org

Git-scm.com Git.wiki.kernel.org