git commitCreate a snapshot of all the added ﬁles$ git commit -m “Adding readme”[master] created d9e1758: “Adding readme”1 files changed, 1 insertions(+), 0 deletions(-)Always add an appropriate commit message!
Typical branches• Master The latest stable version of the project• Staging The branch where the a beta version is tested before it is merged into the master branch• Feature X A branch where a speciﬁc feature is being developed
Creating a branchFrom the base branch$ git branch feature-xSwitching to the new branch$ git checkout feature-x
Merging a branchSwitch to the base branch you want to merge in$ git checkout masterMerge with the branch$ git merge staging
Updating a branchUpdate a feature branch with master branch bug ﬁxes$ git checkout feature-x$ git merge master
Removing a branch$ git branch -D feature-useless
.gitignoreA list of ﬁles that should be ignored# OS generated files.DS_Store.TrashesThumbs.db# ConfigConfig.php
When all hope is lostRevert all changes to the last pulled version$ git reset --hard HEAD
Credential cacheAdd cache to credentials to prevent typing username and passwordover and over again$ git config --global credential.helper cacheDefault cache is 15 minutes, to change cache use$ git config credential.helper cache --timeout=3600
SSH keysWARNING! Only when you do not have an existing key pair$ ssh-keygen -t rsa -C "email@example.com"Generating public/private rsa key pair.Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]Enter passphrase (empty for no passphrase): [Type apassphrase]
SSH keys (2)Add your public SSH key to your github account (account settings)$ cat ~/.ssh/id_rsa.pubTest your settings$ ssh -T firstname.lastname@example.orgHi username! Youve successfully authenticated, butGitHub does not provide shell access.
Good luck thanksTim De Pauw, Pieter Colpaert, Hannes Van De Vreken