git crib

Install git (debian)

sudo apt-get install git-core


Generate SSH keys


Clone a project (svn checkout equivalent)

git clone
Creates projectname directory and clones the project.

Add a file to the repository

git add filename

Show project status

git status

Commit to the local repository

git commit -a -m "change description"

Upload to the central repository

git push
or (see user configuration),
git push

Discard all local changes including newly added files

git reset --hard

Discard options

f you want to revert changes made to your working copy, do this:
git checkout .
If you want to revert changes made to the index (i.e., that you have added), do this:
git reset
If you want to revert a change that you have committed, do this:
git revert ...
Taken from:

Show differences

Update project, download changes (svn update equivalent)

git pull

Show diff between master and local repository

git diff


Make a new branch

git branch rama

Show branches

git branch

Go to the branch rama

git checkout rama

Merge with master

git branch master (goto the main branch)
git merge "rama" (merge rama with main)

User configuration


To automate the pulls:

View the reponame
git config -l

And then
sudo git config remote.origin.url https://{USERNAME}:{PASSWORD}{USERNAME}/{REPONAME}.git

Find all *.pyc and remove from the repository

find . -name "*.pyc" -exec git rm -f {} \;

Ignore some types of files (global)

git config --global core.excludesfile ~/.gitignore_global

Edit ~/.gitignore_global and add patterns like *.pyc

Ignore some types of files (local)

At the local repository edit .gitignore and add patterns.