Peter Harkins - [email protected] - @pushcx - http://push.cx
No photos, please (camera shy); notes will be online at: http://gist.github.com/pushcx
Wifi: Holiday Club / H0lidayclub!
http://git-scm.org Homepage
http://github.com GitHub
GitHub is not Git Bitbucket is another popular Git hosting site
starting a project: git init .
getting started with git itself: git config --global user.name "Peter Harkins" git config --global user.email "[email protected]" git config --global color.ui auto config is stored in ~/.gitconfig git help config
core steps:
- edit a file or files
- git status
- git add actors
- git status
- git commit -m "message"
- git status
so what happened? git log git diff
git commit # without -m, to write a longer message git show 640a9 # or whatever the hash starts with
Git commits are named as hashes to uniquely identify them and know that no one has edited history
git checkout 456sadf... to roll back to a specific version from the past
detached HEAD, oh no! it's ok, it just means you're not at the latest commit in a branch
git show 7d4c29:actors # to see a specific file at one commit
to go back to editing at the latest commit: git checkout master
'master' is the default branch branching lets you create alternate versions of reality, switch between them, and merge them
to create a new branch: git checkout -b music
git commit -m "..." git checkout master
git merge # to bring the two branches back together
git cherry-pick 234lkj
merge conflict: when you try to change the same lines of the same file on two branches. Git can't guess which change is 'right', so it's your job to resolve the conflict.
<<<<<<< HEAD
=======
David J. Bowie
>>>>>>> music
git branch
git push share your work with others
git fetch to get the work of others
git merge to merge their work into yours
git pull fetch + merge at the same time
git help command
git clone copy a remote repo to this computer
git add -p to 'patch' and add only parts of files
git stash save git stash pop to carry files between branches, but don't forget you stashed :) git stash list to see stashed commits
GUIs gitk Tower - really nice and friendly, very visual TortoiseGit GitHub for Windows is good there are many more
http://try.github.io - an in-browser walkthrough tutorial - super helpful
-
Official Git Documentation: http://git-scm.com/documentation The Book is good, and there are excellent resources available in the External Links: http://git-scm.com/documentation/external-links
-
Git Parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html Nice for understanding git at a conceptual level.
-
Git Cheatsheet: https://github.com/nerdgirl/git-cheatsheet-visual A printable one-page guide to git. Hang this at your desk.
-
Git Cheatsheet: http://ndpsoftware.com/git-cheatsheet.html An interactive guide to the commands that move data around in git.
-
Visual Git Reference: (http://marklodato.github.com/visual-git-guide/index-en.html A more detailed guide to git
-
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html How to write good commit messages