[[PageOutline]] = Tips and Tricks for using Git with WebKit = * [wiki:"Moving to Git" Proposal for moving WebKit development to Git] == Install == If you're using [http://www.finkproject.org/ Fink]: {{{ fink install git }}} or if you're using [http://www.macports.org/ MacPorts]: {{{ port install git-core }}} or if you're using [http://www.macports.org/ MacPorts] and you want to track the svn repository (e.g., a committer): {{{ port install git-core +svn }}} or perhaps you'd like to use a 3rd party Mac OS X [http://metastatic.org/text/Concern/2007/09/15/new-git-package-for-os-x/ git install package] == Checkout == To checkout WebKit using git: {{{ git clone git://git.webkit.org/WebKit.git WebKit }}} If you'd also like to track the svn repository (the {{{git update-ref}}} command is the secret to reusing the cloned git repository to fast-forward to the tip of the svn repository): {{{ cd WebKit git update-ref refs/remotes/trunk origin/master git svn init -T trunk http://svn.webkit.org/repository/webkit }}} == Updating == If you are tracking the svn repository, this command will fetch information about new commits from svn, reset your local branch to match svn exactly, and then apply your local commits on top: {{{ git svn rebase }}} If you are tracking the svn repository, this command will fetch information about new commits from svn: {{{ git svn fetch }}} == WebKit Script support for Git == The various scripts in WebKitTools/Scripts have been made to work pretty well with Git. Here are some of the specific things you can do with them: * Telling the various scripts to '''append the git branch name to every build'''. This is especially useful so you don't clobber your previous branch's build when you switch branches {{{ git config core.webKitBranchBuild (true|false) //the default is off }}} * Overriding the core.webKitBranchBuild setting for a specific branch {{{ git config branch.$branchName.webKitBranchBuild (true|false) }}} * Using '''prepare-Changelog''' with git {{{ WebKitTools/Scripts/prepare-ChangeLog --git-commit=$committish --git-reviewer="Foo Reviewer" }}} * Using '''resolve-ChangeLog''' with git. Assuming you got a conflict merging a ChangeLog file, this tool will reapply the patch using {{{patch --fuzz=3}}} so that your change lands at the top of the ChangeLog file. If the patch was successfully applied, {{{git-add}}} is run on the ChangeLog file. Note that this tool does not change the date of the ChangeLog entry (unlike {{{svn-apply}}}). {{{ WebKitTools/Scripts/resolve-ChangeLogs path/to/ChangeLog [path/to/ChangeLog ...] }}} * Using '''commit-log-editor''' with git (assuming {{{WebKitTools/Scripts}}} is in your path) {{{ git config core.editor commit-log-editor }}} == Misc. Tips and Tricks == * You can setup '''Git shell completion and branch name in your bash prompt.''' In your /path/to/git/source/contrib/completion directory you will find a 'git-completion.bash' file. Follow the instructions in that file to enable shell completion. Here is a nice bash prompt for instance {{{ PS1='\[\033[41;1;37m\]\u@\h:\[\033[40;1;33m\]\W$(__git_ps1 " (%s)")>\[\033[0m\] ' }}} * You can set up '''multiple working directories to work on more than one branch at a time.''' In your /path/to/git/source/contrib/workdir directory you will find a 'git-new-workdir' script that can create new working directories. The usage is {{{ ./git-new-workdir [] }}} * Colorize various git commands {{{ git config --global color.status auto git config --global color.diff auto git config --global color.branch auto }}} * Important git config settings {{{ git config --global user.name "Foo Bar" git config --global user.email "foo@webkit.org" }}} * Install WebKit project-specific git scripts {{{ git clone git://git.ndesk.org/pub/scm/git-porcelains cd git-porcelains make }}} Note: git-send-bugzilla requires Crypt::SSLeay More info @ http://git.ndesk.org/?p=git-porcelains;a=summary