22. Conflicts
A file was modified since the last pull
$ git push origin master
! [rejected] master -> master (non-fast-forward)
23. Inspecting the conflict
Update your repository
$ git pull
View conflict info
$ git status
Unmerged paths:
both modified: README
24. Resolving the conflict
Open the conflicted file in your favorite editor
$ nano README
<<<<<<< HEAD
Yes, this is Dog? ] local repository
=======
Who is Dog?
>>>>>>> a0b0bf3
] remote repository
28. 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 specific feature is being developed
29. Creating a branch
From the base branch
$ git branch feature-x
Switching to the new branch
$ git checkout feature-x
30. Merging a branch
Switch to the base branch you want to merge in
$ git checkout master
Merge with the branch
$ git merge staging
31. Updating a branch
Update a feature branch with master branch bug fixes
$ git checkout feature-x
$ git merge master
34. .gitignore
A list of files that should be ignored
# OS generated files
.DS_Store
.Trashes
Thumbs.db
# Config
Config.php
35. When all hope is lost
Revert all changes to the last pulled version
$ git reset --hard HEAD
36. Credential cache
Add cache to credentials to prevent typing username and password
over and over again
$ git config --global credential.helper cache
Default cache is 15 minutes, to change cache use
$ git config credential.helper 'cache --timeout=3600'
37. SSH keys
WARNING! Only when you do not have an existing key pair
$ ssh-keygen -t rsa -C "your@email.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 a
passphrase]
38. SSH keys (2)
Add your public SSH key to your github account (account settings)
$ cat ~/.ssh/id_rsa.pub
Test your settings
$ ssh -T git@github.com
Hi username! You've successfully authenticated, but
GitHub does not provide shell access.
39. Good luck
thanks
Tim De Pauw, Pieter Colpaert, Hannes Van De Vreken