wiki:GitMirror

Version 4 (modified by Screwtape, 4 years ago) (diff)

Added merging instructions.

A Git mirror of the entire Twisted repository is available.

Checking out

git clone http://svn.twistedmatrix.com/git/Twisted/.git

Note that even if you have Twisted commit access, you can't create or merge branches this way — you must use SVN directly, make your own Git mirror with git svn, or obtain a copy (not a clone) of such a Git mirror. If you do choose to make your own Git mirror with git svn, it takes about a week to import the entire Twisted commit history as of early 2010.

Git isn't ignoring .pyc files!

There is no .gitignore in the repository. This is intentional — there's no svn:ignore properties in the official SVN repository either — on the grounds that different people might want to ignore different things. Instead, you can tell Git to ignore things by adding rules to the .git/info/exclude file. Here's an example:

*~
*.py[co]
_trial_temp
dropin.cache
*.o
*.lo
*.la

See the Git documentation on .gitignore, particularly core.excludesfile, for more information.

git svn operations seem to take forever

If you have your own git svn clone, and svn-based operations seem to take forever, try running:

git svn info

If that takes longer than 30 seconds to run, and eventually prints an error message, this is a clue that git svn has gotten confused about how your current branch connects to the imported SVN history. Either git checkout a git branch that's based on an SVN branch or (if you're already on such a branch, and it's broken) use git reset some-remote-branch-name to make sure your local branch is pointing exactly at a commit that was imported from SVN.

git svn branching

Follow the standard Twisted branch-name conventions when creating branches with Git. In the following example, $BRANCH_NAME means the name of the branch you're trying to create.

# Make a branch in the central SVN repository.
git svn branch $BRANCH_NAME

# Make a local branch that you can commit changes to, and switch to it.
git checkout -b $BRANCH_NAME remotes/$BRANCH_NAME

git svn branch merging

In the following example, $BRANCH_NAME means the name of the branch you're trying to merge to trunk.

# Check out the trunk (what git calls 'master'), make sure it's up-to-date.
git svn fetch && git svn rebase

# Apply all the changes on the branch to the trunk as one change set.
git merge --squash remotes/$BRANCH_NAME

# Commit the change set. Remember to use the Canonical Merge Commit Message Format!
git commit

# Push the commit to the central SVN repository.
git svn dcommit

By "Canonical Merge Commit Message Format", I mean the example merge commit message in the Working From Twisted's Subversion Repository documentation.