git obstacle course: stop bashing your head and break down the basics
TRANSCRIPT
about me• Cleveland, OH
• .NET Web Developer
• CardinalCommerce
• @cjb5790
• http://chris.bohatka.com
why should I get git?• decentralized
• works offline (default)
• flexible
• lightweight
• widely supported
• better control
git bash• shell running in cygwin
• cygwin = terminal
• terminal = program that runs a shell
• shell = program that runs commands
• console = type of terminal
basic bash commands
ls list files in current directory
cd change current directory
touch create a new blank file
rm remove a file
mv “move” - rename file
mkdir create a new directory
rmdir remove a directory
rm -rf remove directory and contents
more show the contents of a file
branches• branching is EXTREMELY cheap in git
• performant
• easy (straight-forward)
• you will branch A LOT
• most branches will be local only
• branch life expectancy is very short
git mergetool• resolve merge conflicts using GUI of your choice
• KDiff3 - http://kdiff3.sourceforge.net
• AraxisMerge - http://www.araxis.com/merge/index.en
git mergetool -t <tool name>
git mergetool
git config --global mergetool.kdiff3.path /Applications/kdiff3.app/Contents/MacOS/kdiff3
git revert & reset• revert
• single commit
• reset
• all changes since last commit
git revert <commit> git reset
gitflow• promotes positive development workflow
• easily differentiates new features and bugs
• streamlines release management
• allows easy “logging” of changes
* http://nvie.com/posts/a-successful-git-branching-model/
git aliases• git command
• stores in git config file
• user specific
git config --global alias.nameOfAlias “command to alias”
git aliases
git config --global alias.hadouken ‘push’
git config --global alias.cm ‘commit -a -m’
git config --global alias.glog ‘log --graph’
bash aliases
alias gcm=‘git commit -a -m’
alias gpull=‘git pull’
alias gpush=‘git push’
alias newrepo=‘git init’
resources• https://git-scm.com/doc
• https://try.github.io
• https://www.atlassian.com/git/
• https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf