Basics

git clone
git stash

add a submodule to a project

git submodule add dist.git local_dir

checkout submodules after cloning

git submodule init
git submodule update

bisecting

git bisect start
git bisect bad # actual commit
git bisect good <commit> # last good commit
then git bisect good/bad regarding the case
git bisect reset
git branch --track LOCAL_NAME remotes/origin/DIST_NAME

Create a new repository for collaboration

on the distant server (and accessible):

git init --bare

on the local machine:

git clone ssh://serveurdistant/full/path/name.git name
git add
git commit
git push origin master
git push origin :BRANCH #delete a dist branch

if the local repository was already started:

git remote add origin ssh://distant_server/full/path/name.git
git branch --set-upstream-to=origin/master master

edit past commit (do not do that if already pushed)

git rebase --interactive SHA1-OF-THE-COMMIT-BEFORE-THE-ONE-WE-WANT-TO-EDIT

follow a branch

git fetch origin branch-dist:branch-local

add a branch

git push origin branch-name

delete dist branch

git push origin :branch-name

checkout tag

git tag -l git checkout tags/<name>

Git merge with parent

git remote add parent <parent-url>
git pull parent

git rev-list –all | ( while read revision; do git grep -F ‘, 301)’ $revision done )