Skip to content

Instantly share code, notes, and snippets.

@ben
Last active December 11, 2015 11:19
Show Gist options
  • Save ben/4593102 to your computer and use it in GitHub Desktop.
Save ben/4593102 to your computer and use it in GitHub Desktop.
Resources from introductory class at PHP Benelux

Intro Stuff

  • Who's this guy?
  • Who are you?

fork()

10,000-meter level

  • Motivation for DVCS and git
  • Demonstrate git & GitHub

1,000-meter level

  • Install git
  • Introduce yourself
  • Line endings
  • Default editor
  • git init
  • git status
  • Make a commit

100-meter level

  • The Index = shopping cart
  • Included GUI tools
  • Checkout
  • Refs (HEAD, master)
  • Merging and conflicts
  • Working with others
  • Remotes
  • Fetch
  • Push
  • Pull
  • Clone
  • Collaboration models

Ground level

  • Tour of .git
  • Objects and refs
  • Three trees
  • Commit craftsmanship

GitHub

  • Introduce yourself
  • Repositories
  • Forks
  • Users, organizations and teams
  • Stuff you can do from the web UI
  • Issues
  • Pull requests
  • Can I use this thing at work?

Maybe cover this if there's time?

  • Ignoring files
  • Shortcuts ** clone = init + remote + fetch + checkout ** git checkout -b foo = git branch foo; git checkout foo
  • Aliases

Come to my talk tomorrow

  • Bash prompt tricks
  • Time travel
  • Rebase

Not in this talk

  • Read man pages aloud
cowsay rename-edit-merge
ls
git checkout -b edits
vi frank/templates/fullspread.php
git commit -am 'bug fix'
git checkout master
mv frank/templates/fullspread.php frank/templates/new-fullspread.php
mv frank/templates frank/new-templates
git status
git add -A .
git status
git commit -m 'rename'
git merge edits
git commit -m 'Merge'
ls frank/
ls frank/new-templates/
vi frank/new-templates/new-fullspread.php
cowsay git.git
git blame rerere.c
git blame rerere.c -C
clear
cowsay Yak Shaving!
cd ..
git --version
git config --global user.name "Ben Straub"
git config --global user.email bs@github.com
vi ~/.gitconfig
cowsay Your First Repository
git init demo
cd demo
ls
ls -la
echo "Hello" > readme.txt
ls
git add .
git commit -m 'initial commit'
ls
git status
git log
vi readme.txt
git status
git commit -am 'edit'
git log
echo 'dur' > foo.txt
git status
git commit -m 'message'
git gui
vi readme.txt
git commit -am 'Lots of content'
vi readme.txt
git gui
cowsay Checkout; cd demo
git log
gitk
git checkout master~
gitk --all
cowsay Refs & Branches; cd demo
git checkout master
git lg
git show
cat .git/refs/heads/master
git branch
git branch new-branch
git branch
git checkout new-branch
git branch feature2 master~~
gitk --all
cowsay Merging: Not That Scary; cd demo
git checkout feature2
vi readme.txt
git commit -am 'even better'
gitk --all
git merge master
git commit -m 'Merge'
gitk --all
cowsay Merge Conflicts; cd demo
git checkout master
vi readme.txt
git branch conflict
git commit -am 'Great'
git checkout conflict
vi readme.txt
git commit -am 'work'
gitk --all
git merge master
git status
vi readme.txt
vi ~/.gitconfig
git status
vi readme.txt
git mergetool
git mergetool --tool=opendiff
git mergetool
git status
vi ~/.gitconfig
git commit -m 'merged!'
gitk --all
cowsay Working with Others: Remotes; cd demo
git remote
ls ..
git init --bare ../foo.git
git remote add foo ../foo.git
git remote
vi .git/config
cowsay Fetching; cd demo
git fetch foo
git remote add bar ../demo-full.git
git fetch bar
gitk --all
cowsay Remote Refs; cd demo
git branch
git branch -a
git checkout remotes/bar/feature-a
gitk --all
git checkout master
git remote
git push foo master -s
git push -s foo master
export PATH=/opt/github/homebrew/Cellar/git/1.8.0.2/bin:$PATH
git push -s foo master
gitk --all
git push -u foo master
git branch -a
gitk --al
gitk --all
vi readme.txt
git commit -am 'a change'
git push
cowsay Pushing; cd demo
cowsay Pulling; cd demo-full
cd ..
ls
git clone foo.git/
cd foo
ls
git lg
vi readme.txt
git commit -am 'another change'
git push
cd ../demo
ls
rm remote.txt.*
rm readme.txt.*
ls
git fetch
gitk --all
git pull
gitk --all
cowsay Clone = init + fetch + checkout
ls
rm -rf foo
git clone foo.git/
cd foo
cowsay Tour of .git; cd demo/.git
ls
tree
cat refs/heads/master
ls
vi ~/.bash.d/color.sh
export CLICOLOR=0
ls
ls --no-color
cat HEAD
cd ..
git checkout master~
cat .git/HEAD
git checkout master
cd .git
ls
cat HEAD
cat refs/heads/master
git cat-file -p cb8560c9e3883
git ls-tree -r 285f28c1
vi index
ls
gitx
cd ~/src/libgit2
find . -name ".gitattributes"
vi tests-clar/resources/.gitattributes
vi tests-clar/resources/attr_index/sub/sub/.gitattributes
vi .gitignore
git log
git lg
vi ~/.gitconfig
cd ../../class/demo
ls
vi readme.txt
git status
git branch
git checkout feature2
git checkout conflict
git lg
git checkout -b i_have_a_change
git --version
git stash
ls
git status
git stash list
git checkout conflict
git stash pop
git diff
mkdir src
git checkout -f
ls
touch src/.gitkeep
git status
git add src/.gitkeep
git status
~/src/scripts/historytailbash 1 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment