Practical Git

Introduction

Environments

References

Recipes

Distributed Revision Control System

Snapshots vs Differences

WORKING TREE

INDEX

REPOSITORY

git add

git commit

git reset

git checkout

HEAD - Current Position

{pointer}^{n} - n-th parent

{pointer}~{n} - n-th ancestor

Master | HEAD

origin / develop

origin / develop ^ 2

HEAD~

origin / develop ^ ^

.gitconfig

.gitignore

### Mac Shit ###
.DS_Store
Thumbs.db

### Vim Shit ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

Ignore only for yourself (local repository)

git config --local core.excludesfile=/path/to/.gitignore

Globally ignore system / editor files

or, add explicitly in .git/info/excludes

git config --global core.excludesfile=/path/to/.gitignore

temporary ignore files

git update-index --assume-unchanged patate.purs
git update-index --no-assume-unchanged patate.purs
[alias]
    ls-ignored = !git ls-files -v $(git rev-parse --show-toplevel) | grep '^[[:lower:]]'

change messages of a bunch of commits

git filter-branch --msg-filter 'echo "v14 | $(cat)"' <branch>...<REF_LIMIT>

change the last commit

git add patate.hs
git commit --amend -m "omelette du fromage"


git add patate.elm
git commit --amend -C HEAD

show all commits related to a file

git log --follow patate.exs

Now.

Push Code.

deck

By Matthias Benkort