Vous êtes sur la page 1sur 44

Git > SVN

..and most other VCS

whygitisbetterthanx?
awesome branching! the staging area it's local!

fast, small, distributed... http://thkoch2001.github.com/whygitisbetter/ http://whygitisbetterthanx.com

setup...
git config --global user.name "Keith Mascarenhas" git config --global user.email "keith.mascarenhas@efinlab.com"

git config --global color.ui true

lets begin!
cd app git init

local staging..
Make changes to app.. git status git add . git commit -m 'made xyz change' OR git diff

useful git add shortcuts..


git add . new] git add -u deleted] git add -A [stages modified and deleted, without

[stages new and modified, without

[stages All]

branching! ^^
git branch <new_branch_name> git checkout <branch_name> directory to this branch] [creates branch] [switch current working

'master' is our default root branch.

branching! ^^
git checkout master + git branch issue53 + git checkout issue53 = git checkout -b issue53 master

git checkout -b [new branch name] [source branch name]

merging! ^^
git checkout master git merge issue53

deleting branches..
git branch -d <branch_name> [Recommended]

lets work remote!

setting up unfuddle
cd ../app/ git init git remote add unfuddle git@efl.unfuddle.com:efl/app-dev.git git config remote.unfuddle.push refs/heads/master:refs/heads/master

or just migrate our svn repo!


git svn clone [svn_repo_url] /path/to/git/repo cd /path/to/git/repo git remote add origin git@efl.unfuddle.com:efl/app-dev.git git push origin master

now clone it! [svn checkout]


git clone git@efl.unfuddle.com:efl/app-dev.git

[svn commit]
Make changes in xyz.. git commit -am "changed xyz" git push <-> [svn commit]

git push origin master git push [remote_name] [branchname_you_want_to_commit]

[svn update]
git fetch + git merge origin/master = git pull git pull origin/master <-> [svn update] git pull origin [branch_name]

push a branch to remote!


git checkout -b issue53 branch_x git commit git push origin issue53

Someone else.. git fetch

tagging..
git tag -a v1.0 git tag [list them] git tag -l 'v1.4.2.*'
v1.4.2.1

v1.4.2.2
v1.4.2.3 v1.4.2.4

git show v1.0 git push origin --tags

misc..
git log [--oneline] [--graph] [--all] [--stat]

git config --global alias.lolz "log --oneline --graph all"

git lolz --decorate


git config --global alias.co "checkout"

git log issue53 ^master [incoming: origin/master ^master] git log issue52 ^issue53 [outgoing: master ^origin/master]

git roundup!

git config

git init

git clone

git status

git add

git commit

git branch

git checkout

git merge

git push

git fetch

git merge

our workflow

thanks to Vincent Driessen (http://nvie.com/posts/a-successful-gitbranching-model/)

(app-dev)

(app-stg)

(app-prod)

app85

app85.0.1

app87

(app-dev)

(app-stg)

(app-prod)

app85

app85.0.1

app87

(app-dev)

(app-stg)

(app-prod)

app85

don'
t freak out!
app85.0.1

app87

(app-dev)

(app-stg)

(app-prod)

app85

app85.0.1

app87

(app-dev) (app-dev)

(app-prod)

app85

main branche s

app87

app89

Creating a feature branch


When starting work on a new feature, branch off from the develop branch.
$ git checkout -b myfeature developSwitched to a new branch "myfeature"

Incorporating a finished feature on develop


Finished features may be merged into the develop branch definitely add them to the upcoming release:
$ git checkout developSwitched to branch 'develop'$ git merge --no-ff myfeatureUpdating ea1b82a..05e9557(Summary of changes)$ git branch -d myfeatureDeleted branch myfeature (was 05e9557).$ git push origin develop

feature:branch off develop

feature branche s

merge back into develop

name: anything except: master, develop, hotfix-*, release-*

(app-dev)

(app-prod)

app85

app87

--no-ff?

(app-dev)

(app-stg)

(app-prod)

app85

app85.0.1

release & hotfix branches

app87

release:branch off develop merge back into develop & master

(app-dev)

(app-stg)

(app-prod)

app85

name: release-*

app85.0.1

hotfix: branch off master merge back into develop & master

name: hotfix-*
app87

thats it!

you dont need to rtfd but it helps..


gitref.org git-scm.com/docs Introduction to Git - Scott Chacon bit.ly/introtogit bit.ly/introtogitdeck Branching Model bit.ly/branchingmodel This awesome deck! http://bit.ly/thisdeck

Vous aimerez peut-être aussi