DrupalCafe5 VCS
Upcoming SlideShare
Loading in...5
×
 

DrupalCafe5 VCS

on

  • 1,811 views

Version Control Systems: Mercurial and Git

Version Control Systems: Mercurial and Git

Statistics

Views

Total Views
1,811
Views on SlideShare
1,811
Embed Views
0

Actions

Likes
1
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

DrupalCafe5 VCS DrupalCafe5 VCS Presentation Transcript

  • Version Control Systems Yuriy Gerasimov Madcap B.V. [email_address]
  • 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 <files> -m ‘message’)
    • hg rollback (rollback last commit)
    • hg update (hg update -C)
    • hg revert -r <rev> --all
    • hg tag
  • Mercurial
    • hg log
    • -l5 – last 5 commits
    • --graph – graph view (-G)
    • --style compact / changelog / <custom>
    • -d’Dec 9’ – date
  • Mercurial
    • hg pull (hg pull -u)
    • hg push
    • hg heads
    • hg merge
  • Mercurial $ hg pull ../my-hello pulling from ../my-hello searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge)
  • Mercurial
  • Mercurial hg merge hg update -C hg merge
    • Wrong conflict resolution
  • Mercurial
    • hg serve
    • localhost:8000
  • Mercurial
    • .hgignore
    • hg forget
    • hg blame
  • Mercurial
    • Mistakes
      • Edit file. hg revert (creates .orig file)
      • File management errors (add / remove). hg revert
      • Wrong commit
        • Last commit. hg backout -m ‘message’
        • Not last commit. hg backout --merge -m ‘message’ -<rev>
  • 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 <file> (add file to index, staging area)
    yuriy@dell-desktop:~/gitpresentation/repo1$ git status # On branch master # Changed but not updated: # (use &quot;git add <file>...&quot; to update what will be committed) # (use &quot;git checkout -- <file>...&quot; to discard changes in working directory) # # modified: test.txt # # Untracked files: # (use &quot;git add <file>...&quot; to include in what will be committed) # # README no changes added to commit (use &quot;git add&quot; and/or &quot;git commit -a&quot;)
  • git
    • git commit (git commit -a -m)
    • git diff (--cached, --no-prefix)
    • git rm
  • git
    • git log
      • git log -p -2 – add diff to output, only last two
      • git log –pretty=oneline --graph
      • git log --pretty=format:&quot;%h - %an, %ar : %s&quot;
  • git
    • gitk
  • git
    • gitg
  • git
    • git commit --amend – change last commit
    • git reset HEAD <file> – unstage file
    • git checkout -- <file> – unmodify file
  • git
    • git add -i – interactive staging
  • git
    • git stash (git stash apply)
    $ git stash list stash@{0}: WIP on master: 049d078 added the index file stash@{1}: WIP on master: c264051... Revert &quot;added file_size&quot; 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 <branch>
    • git checkout -b <branch>
    • git merge <branch>
    • git branch -d
  • Mercurial
    • Anonymous branches (heads)
    • Named branches
      • hg branch
      • hg update <branch>
    • Bookmarks
  • git
    • Remote branches
      • git 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 master Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result.n yuriy@dell-desktop:~/gitpresentation/repo1$ cat test.txt hello <<<<<<< HEAD new line conflict ======= master line >>>>>>> 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 <y.gerasimov@mdacap.nl> 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/hg kiev.username = yuriy kiev.password = abcd local.prefix = http://hg.yuriy-desktop local.username = yuriy local.password = abcd .gitconfig [color] ui = auto [color &quot;diff&quot;] 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 = yuri.gerasimov@gmail.com
  • 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
    • hg
      • Mercurial: The Definitive Guide
      • http://mercurial.selenic.com/guide/
    • git
      • http://drupal.org/node/783086
    • http://www.proft.com.ua/2010/10/17/spravochnik-po-git-i-mercurial/
  • Version Control Systems Yuriy Gerasimov Madcap B.V. [email_address]