DrupalCafe5 VCS

download DrupalCafe5 VCS

If you can't read please download the document

Transcript of DrupalCafe5 VCS

Version Control Systems

Yuriy GerasimovMadcap [email protected]

Centralized VCS

SVN

CVS

Distributed VCS

Mercurial

Git

Bazzar

Mercurial

hg init

hg clone http://hg.serpentine.com/tutorial/hello

hg clone repo repo_clone

hg clone ssh://user@server//srv/hg/repo

Mercurial

hg status (hg st)

hg diff

hg add

hg rm

hg addremove

Mercurial

hg commit (hg ci -m message)

hg rollback (rollback last commit)

hg update (hg update -C)

hg revert -r --all

hg tag

Mercurial

hg log

-l5 last 5 commits

--graph graph view (-G)

--style compact / changelog /

-dDec 9 date

Mercurial

hg pull (hg pull -u)

hg push

hg heads

hg merge

Mercurial

$ hg pull ../my-hellopulling from ../my-hellosearching for changesadding changesetsadding manifestsadding file changesadded 1 changesets with 1 changes to 1 files (+1 heads)(run 'hg heads' to see heads, 'hg merge' to merge)

Mercurial

Mercurial

hg mergehg update -Chg merge

Wrong conflict resolution

Mercurial

hg serve

localhost:8000

Mercurial

.hgignore

hg forget

hg blame

Mercurial

MistakesEdit file. hg revert (creates .orig file)

File management errors (add / remove). hg revert

Wrong commitLast commit. hg backout -m message

Not last commit. hg backout --merge -m message -

Mercurial

Hooks (hgrc file in .hg folder)

Meld (hg meld)

Fetch (hg fetch)

[hooks] changegroup = hg update >&2

[extensions]hgext.extdiff =[extdiff]cmd.meld =

[extensions]fetch =

git

git init

git clone

git add (add file to index, staging area)

yuriy@dell-desktop:~/gitpresentation/repo1$ git status# On branch master# Changed but not updated:# (use "git add ..." to update what will be committed)# (use "git checkout -- ..." to discard changes in working directory)##modified: test.txt## Untracked files:# (use "git add ..." to include in what will be committed)##READMEno changes added to commit (use "git add" and/or "git commit -a")

git

git commit (git commit -a -m)

git diff (--cached, --no-prefix)

git rm

git

git loggit log -p -2 add diff to output, only last two

git log pretty=oneline --graph

git log --pretty=format:"%h - %an, %ar : %s"

git

gitk

git

gitg

git

git commit --amend change last commit

git reset HEAD unstage file

git checkout -- unmodify file

git

git add -i interactive staging

git

git stash (git stash apply)

$ git stash liststash@{0}: WIP on master: 049d078 added the index filestash@{1}: WIP on master: c264051... Revert "added file_size"stash@{2}: WIP on master: 21d80a5... added number to log

git

git rebase -i HEAD~3

edit

squash

reorder

git

git branch (-a)

git checkout

git checkout -b

git merge

git branch -d

Mercurial

Anonymous branches (heads)

Named brancheshg branch

hg update

Bookmarks

git

Remote branchesgit fetch origin

git push (remote) (branch)

Mercurial

Mercurial pulls and push all changesets. No matter what branch.

git

Merge conflict

yuriy@dell-desktop:~/gitpresentation/repo1$ git merge masterAuto-merging test.txtCONFLICT (content): Merge conflict in test.txtAutomatic merge failed; fix conflicts and then commit the result.n

yuriy@dell-desktop:~/gitpresentation/repo1$ cat test.txt hello> master

git

mergetool

git

git pull

git rebase

hg rebase

[extensions]rebase =

git

Git-serve (https://github.com/jezdez/git-serve)

Set up server

Mercurial hgweb.cgi

git gitweb.cgi

[collections]/srv/hg = /srv/hg

svn git hg

git-svn

hg-git

Config files

.hgrc[ui]username = Yuriy Gerasimov style = compact[extensions]hgext.extdiff =hgext.graphlog =fetch =hgext.bookmarks =rebase = hggit = /home/yuriy/programs/hg-git/hggit[git]intree = True[extdiff]cmd.meld =[bookmarks]track.current = True[auth]kiev.prefix = http://kiev.madcap.nl/hgkiev.username = yuriykiev.password = abcdlocal.prefix = http://hg.yuriy-desktoplocal.username = yuriylocal.password = abcd

.gitconfig[color] ui = auto[color "diff"] meta = yellow bold frag = magenta bold old = red bold new = green bold whitespace = red reverse[core] whitespace=fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol[alias] df = !git diff --no-prefix && git diff --staged --no-prefix clear = reset --hard st = status co = checkout br = branch ci = commit unstage = reset HEAD --[user] name = Yuriy Gerasimov email = [email protected]

Public services

hg: bitbucket.org

git: github.com

Drupal goes git way

http://groups.drupal.org/drupal-org-git-migration-team

http://git.drupalcode.org/

https://github.com/drupal/drupal

Resources

hgMercurial: The Definitive Guide

http://mercurial.selenic.com/guide/

githttp://drupal.org/node/783086

http://www.proft.com.ua/2010/10/17/spravochnik-po-git-i-mercurial/

Version Control Systems

Yuriy GerasimovMadcap [email protected]

A