hello git
TRANSCRIPT
Hello git :)
Get git:Mac: $ brew install git
Linux: $ apt-get install git-core
Windows: msysgit
version control
CVS or SVN
mercurial (hg)
bazaar
subversion (svn)
concurrent version system (cvs)
preforce
visual source safe
“not bad”mercurial (hg)
bazaar
subversion (svn)
concurrent version system (cvs)
preforce
visual source safe
“kill self”
mercurial (hg)
bazaar
subversion (svn)
concurrent version system (cvs)
preforce
visual source safe
mercurial (hg)
bazaar
subversion (svn)
concurrent version system (cvs)
preforce
visual source safe
git
What is git?
git is an open source,distributed version control
system designed for speed and efficiency
Who uses git?
git is an open source,distributed version control
system designed for speed and efficiency
git-scm.com
git is an open source,distributed version controlsystem designed for speed
and efficiency
Fully Distributed
(almost) everything is local
everything is fast
every clone is a backup
work offline
No Network Needed
Performing a diffViewing file history
Committing changesMerging branches
Obtaining other revisions of a fileSwitching branches
git is an open source,distributed version control
system designed for speed and efficiency
(almost) never removes data
Snapshots, not Patches
Starting with git
$ git config --global user.name “Josh Dvir”
$ git config --global user.email “[email protected]”
Getting a repo
Create One:
$ git init
Clone One:
$ git clone
Basic commands:● Add a file (git add)● Commit changes (git commit)● See logs (git log)● Remove a file (git rm)● Jump to commit or branch (git checkout)● Create branch (git branch branch_name)● Put aside temporary changes (git stash)● Merge branches (git merge)● Push commits (git push)● Pull commits (git pull)
Workshopstart your laptops...
git init$ cd /path/to/repos$ mkdir project_name$ cd project_name$ git init$ ls -alh
git add
$ touch README$ echo “Read Me” >> README$ echo “Learn git!” > TODO$ git add . # will add all files
git status$ git status
$ git commit -m “Adding 2 files”
# TODO and README committed to git.
$ git status # no changes
git commit
git branch$ git branch my_awesome_branch
$ echo “dude file changed” >> README
$ git status# README is staged to commit.
$ git commit -m “README has changed”
git checkout$ git checkout master
git merge$ git merge my_awesome_branch
$ git log# see the new commit
github.combitbucket.org
code.google.com
$ git remote add origin [email protected]:username/project.git
git remote
$ git push origin master
$ git push other_remote master
$ git push third_remote my_awesome_branch
git push
$ git pull origin master
$ git pull other_remote master
git pull
github flow
● Anything in the master branch is deployable
● To work on something new, create a descriptively named
branch off of master
● Commit that branch locally and regularly push your work
to the same named branch on the server.
● When you need feedback or help, or you think the branch
is ready for merging, open a pull request.
● After someone else has reviewed and signed off on the
feature, you can merge it into master
● Once it is merged and pushed to master, you can and
should deploy immediately.
1. http://git-scm.com/2. http://www.slideshare.net/chacon/git-101-
presentation3. http://scottchacon.com/2011/08/31/github-
flow.html4. http://rogerdudler.github.io/git-guide/5. http://gitimmersion.com/
Resources: