23
Git is my hero Git is my hero Selena Deckelmann

Git is my hero

Embed Size (px)

DESCRIPTION

Very short talk on revision control systems and intro to git. Given at Code-N-Splode on September 23, 2008.

Citation preview

Page 1: Git is my hero

Git is my heroGit is my hero

Selena Deckelmann

Page 2: Git is my hero

Not this guy:

Page 3: Git is my hero

Git is my hero

Page 4: Git is my hero

More like this:

Page 5: Git is my hero

BEFORE:cp specialfile.c specialfile.c.bakvi specialfile.ccp specialfile.c specialfile.c.200809221522ls -alr

AFTER:git initgit add specialfile.cgit commit -m “making changes”vi specialfile.cgit commit -a -m “made change, saved world”

Page 6: Git is my hero

Why REVISION CONTROL?

Page 7: Git is my hero
Page 8: Git is my hero

Figure out what you did (later)Document what you did (right then)

Use tools designed for this

Page 9: Git is my hero

A short history ofRevision Control Systems:

Page 10: Git is my hero

Ancient: SCCS (1972)Old School: RCS (ci / co)Centralized: CVS / SubversionDecentralized: Git / Mercurial / Bazaar / SVK

Page 11: Git is my hero

DOWNLOAD:http://git.or.cz/

Page 12: Git is my hero

Quickly: git clonegit loggit init

git statusgit diff

git commitgit revert

Page 13: Git is my hero

DEMONSTRATION

Page 14: Git is my hero

Important notes:

changing file names(git mv)

Page 15: Git is my hero

Important notes:

directories(if they're empty, git doesn't care

about them)there's a way around this:

.gitignore

Page 16: Git is my hero

Empty directory recipe for .gitignore:

*!.gitignore

Note: Rules are recursive

Page 17: Git is my hero

Best Practice:

designate a place for“authoritative” storage

Page 18: Git is my hero

Important notes:

pushed changes aren'tautomatically shownin checked-out files

(in the “authoritative” repo)Best practice: don't check out

in the central repo

Page 19: Git is my hero

Do things once: git remote add NAME $URL

Page 20: Git is my hero

Git URLs:/home/you/git

git://user@host/path/to/gitssh://user@host/path/to/git

http://somehost.com/git

Page 21: Git is my hero

REMOTES URLcreate with a refspec, located in one of: .git/config.git/remotes.git/branches

Or on the command-line.

Page 22: Git is my hero

git add remote community9 \ ssh://selena@blah/home/selena/pg_top/

makes this: [remote “community9”] url = ssh://selena@blah/home/selena/pg_top/ fetch = +refs/heads/*:refs/remotes/community9/*

Page 23: Git is my hero

More fun: git stash

git branchgit resetgit pushgit pull

get fetchgit merge

git rebase - DANGER!