git obstacle course: stop bashing your head and break down the basics

Download Git Obstacle Course: Stop BASHing your head and break down the basics

Post on 08-Jan-2017




0 download

Embed Size (px)


Git Obstacle CourseStop BASHing your head and break down the basics

SVN -> Git transition a few times

Wrote this talk after designers were having issues with Git

Mt. Midoriyama

about meCleveland, OH.NET Web DeveloperCardinalCommerce@cjb5790

Marketing hat = We are the industry leader in Card Not Present authentication and authorization.

Past experience working from network drive

What are people using?

why should I get git?decentralizedworks offline (default)flexiblelightweightwidely supportedbetter control

Source control is about more than checking into a central repository.

install git (windows)

install git (windows)

install git (mac)

now what?

lets create our first repobut how?


github for windows

atlassian sourcetree

axosoft gitkraken

git bashshell running in cygwincygwin = terminalterminal = program that runs a shellshell = program that runs commandsconsole = type of terminal

what is git bash?- ironically, not a developer conference. Thats Git Merge

command line (CLI)

Git is a gateway drug to understanding CLI



Mac = case sensitive

Unix Shell

basic bash commandslslist files in current directorycdchange current directorytouchcreate a new blank filermremove a filemvmove - rename filemkdircreate a new directoryrmdirremove a directoryrm -rfremove directory and contentsmoreshow the contents of a file

creating a repogit init


add filesgit add

stageall files that will be committed, but have not been committed yet

git ignore

lets commit

how to commitgit commit

WARNING - this will launch Vi

but before we commit...

...ALWAYS diff!

ALWAYS diffgit diff

git difftoolgit difftool -t git difftool

git difftoolgit config --global diff.tool kdiff3

git != svn | tfs | vss

Network Drive example

git commitgit commit -agit commit -a -mgit commit -a -m [commit message]

Stage, without -a flag, you will need to git add every file

commit early, commit often


branch life expectancy

branchesbranching is EXTREMELY cheap in gitperformanteasy (straight-forward)you will branch A LOTmost branches will be local onlybranch life expectancy is very short

branchesgit branch shiny-new-featuregit checkout shiny-new-feature

git checkoutswitches active branchdoesnt actually pull any filesunless you git fetch

Git has a copy of all branches

You checkout the whole repo

creating a branch

removing a branch

git mergegit merge

Web UIs for remote hosts have better than average merge UIs

git mergetoolresolve merge conflicts using GUI of your choiceKDiff3 - http://kdiff3.sourceforge.netAraxisMerge - mergetool -t

git mergetoolgit config --global mergetool.kdiff3.path /Applications/

git mergetoolgit mergetool -t kdiff3

git mergetoolgit config --global merge.tool kdiff3

git mergetoolgit mergetool

remotesRemote(GitHub, Bitbucket, etc)Clone #1(My PC)Clone #2(Co-Workers PC)

repository hosts


-u = -set--upstream

how to pull/pushgit pullgit push

git revert & resetrevertsingle commitresetall changes since last commitgit revert git reset

git cherry-pickgit cherry-pick

branch with a bunch of unneeded commits, but one good one

gitflowpromotes positive development workfloweasily differentiates new features and bugsstreamlines release managementallows easy logging of changes*

tagsgit tag -a -m git tag -a v1.0 -m MVP launch

git aliasesgit commandstores in git config fileuser specificgit config --global alias.nameOfAlias command to alias

git aliases

git config --global alias.hadouken pushgit config --global commit -a -mgit config --global alias.glog log --graph

commit with alias

bash aliasesshell level shortcutalias nameOfAlias=command to alias

bash aliasesalias gcm=git commit -a -malias gpull=git pullalias gpush=git pushalias newrepo=git init

If youre tired of typing git all the time

git autocorrectgit config --global help.autocorrect 10

10 is number of seconds it will wait


thank you@cjb5790