wiki:UsingGitWithWebKit

Version 4 (modified by Simon Hausmann, 14 years ago) (diff)

--

Branch Overview

There are three types of branches in the QtWebKit Git repository:

  • <username>/* : This is where developers publish their changes. You can have as many so-called topic branches as you like. For example holger/crash-fix would be a name for such a topic branch.
  • qtwebkit: This is the main development branch. Currently only Lars and Simon can update this branch. If you feel comfortable enough with Git we can add you.
  • svn/* such as svn/master or svn/Safari-3-branch. The branches prefixed with svn/ are read-only and are mirrored from the WebKit Subversion repository.

Howto

Getting Started

  • Clone your git repository from git+ssh://git@code.staikos.net/srv/git/webkit
  • After that you will have one local branch called qtwebkit.

Step-by-step instructions

(Note: Substitute simon/crash-fix accordingly)

  • Create a local topic branch: git checkout -b simon/crash-fix origin/qtwebkit
  • After that you will be on a local simon/crash-fix branch.
  • Now you can hack away and commit as many changes as you want.
  • To publish your changes for the first time run the following command: git push origin simon/crash-fix
  • You can continue hacking and if you want to publish more changes you can just run git push
  • If you want to merge the latest changes from the qtwebkit branch run this:
    git fetch
    git merge origin/qtwebkit
    
  • When you are happy with your changes and they have been merged into the qtwebkit branch you can delete your branch on the public repository using git push origin :simon/crash-fix
  • After deleting the branch on the public repository you can also delete it locally:
    • Switch to a different branch, such as qtwebkit: git checkout qtwebkit
    • Delete the branch: git branch -D simon/crash-fix

Switching from the Trolltech Labs repository

All you have to do is to adjust your origin. Edit the .git/config file and look for the [remote "origin"] section. Change the the url = ... line to read url = git+ssh://git@code.staikos.net/srv/git/webkit

Tips and Tricks for using Git with WebKit

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
      PLEASE FILL ME IN
    
  • Using commit-log-editor with git
      PLEASE FILL ME IN
    

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 <repository> <new_workdir> [<branch>]
    
  • 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"