hello git

45
Hello git :)

Upload: shuky-dvir

Post on 06-May-2015

215 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Hello git

Hello git :)

Page 2: Hello git

<me>Josh Dvir

[email protected]@shukydvir

</me>

Founder & CTO @

Page 3: Hello git

Get git:Mac: $ brew install git

Linux: $ apt-get install git-core

Windows: msysgit

Page 4: Hello git

version control

Page 5: Hello git

CVS or SVN

Page 6: Hello git

mercurial (hg)

bazaar

subversion (svn)

concurrent version system (cvs)

preforce

visual source safe

Page 7: Hello git

“not bad”mercurial (hg)

bazaar

subversion (svn)

concurrent version system (cvs)

preforce

visual source safe

Page 8: Hello git

“kill self”

mercurial (hg)

bazaar

subversion (svn)

concurrent version system (cvs)

preforce

visual source safe

Page 9: Hello git

mercurial (hg)

bazaar

subversion (svn)

concurrent version system (cvs)

preforce

visual source safe

git

Page 10: Hello git

What is git?

Page 11: Hello git

git is an open source,distributed version control

system designed for speed and efficiency

Page 12: Hello git

Who uses git?

Page 13: Hello git

git is an open source,distributed version control

system designed for speed and efficiency

Page 14: Hello git

git-scm.com

Page 15: Hello git

git is an open source,distributed version controlsystem designed for speed

and efficiency

Page 16: Hello git

Fully Distributed

Page 17: Hello git

(almost) everything is local

Page 18: Hello git

everything is fast

every clone is a backup

work offline

Page 19: Hello git

No Network Needed

Performing a diffViewing file history

Committing changesMerging branches

Obtaining other revisions of a fileSwitching branches

Page 20: Hello git
Page 21: Hello git

git is an open source,distributed version control

system designed for speed and efficiency

Page 22: Hello git

(almost) never removes data

Page 23: Hello git

Snapshots, not Patches

Page 24: Hello git
Page 25: Hello git

Starting with git

Page 26: Hello git

$ git config --global user.name “Josh Dvir”

$ git config --global user.email “[email protected]

Page 27: Hello git

Getting a repo

Page 28: Hello git

Create One:

$ git init

Page 29: Hello git

Clone One:

$ git clone

Page 30: Hello git

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)

Page 31: Hello git

Workshopstart your laptops...

Page 32: Hello git

git init$ cd /path/to/repos$ mkdir project_name$ cd project_name$ git init$ ls -alh

Page 33: Hello git

git add

$ touch README$ echo “Read Me” >> README$ echo “Learn git!” > TODO$ git add . # will add all files

Page 34: Hello git

git status$ git status

Page 35: Hello git

$ git commit -m “Adding 2 files”

# TODO and README committed to git.

$ git status # no changes

git commit

Page 36: Hello git

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”

Page 37: Hello git

git checkout$ git checkout master

Page 38: Hello git

git merge$ git merge my_awesome_branch

$ git log# see the new commit

Page 39: Hello git

github.combitbucket.org

code.google.com

Page 40: Hello git

$ git remote add origin [email protected]:username/project.git

git remote

Page 41: Hello git

$ git push origin master

$ git push other_remote master

$ git push third_remote my_awesome_branch

git push

Page 42: Hello git

$ git pull origin master

$ git pull other_remote master

git pull

Page 43: Hello git

github flow

Page 44: Hello git

● 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.