Using Git

Version 4, last updated by David Bernard at almost 15 years

See http://www.assembla.com/code/scala-ide/git/repo/instructions


It is possible to use git-svn to enable local branching of the Scala IDE for Eclipse. This enables contributors to work on several features/bugfixes concurrently, while staying up to date with what's going on in trunk.

To checkout the scala projects, run the following git commands:

git svn clone -T scala/trunk -bscala/branches -tscala/tags http://lampsvn.epfl.ch/svn-repos/scala/ scala
git svn clone -T scala-library/trunk -bscala-library/branches -tscala-library/tags http://lampsvn.epfl.ch/svn-repos/scala/ scala-library
git svn clone -T scala-plugin/trunk -bscala-plugin/branches -tscala-plugin/tags http://lampsvn.epfl.ch/svn-repos/scala/ scala-plugin
git svn clone -T scala-plugin-aspects/trunk -bscala-plugin-aspects/branches -tscala-plugin-aspects/tags http://lampsvn.epfl.ch/svn-repos/scala/ scala-plugin-aspects

The above commands will take a long amount of time (They convert svn history into git history). If you have commit privileges, you should replace the http:// with https:// in the url, and add the --username=<you> flag.

Updating

To update with the current svn checkouts, run the following command in each project directory:

git svn rebase

 

 

 

Daily development inside a local git branch

First, create a new branch for the development you're working on. e.g.

git checkout -b plugin-interpreter-overhaul

Make a few changes locally and perform a local commits, e.g.

touch README-INTERPRETER
git add README-INTERPRETER
git commit -m "Added readme for interpreter

This commit is completely local to your machine, and will not be reflected in the subverison repository. This is a handy way to keep track of your own progress in development, while not requiring "completely finished and stable" commits. When you get your branch to a "completely finished and stable" state, you can then either generate a patch for submission, or commit directly.

 

Switching branches

When desired, you may switch local branches using the checkout command, e.g.

git checkout <branchname> 

 

Reverting local changes

If desired to revert your local changes, simply run:

git checkout -f 

 

Reverting to trunk

git reset --hard HEAD

 

Merging commits across branches

To pull commits from one branch into another (or to/from master), use the merge command, e.g.

git merge <other-branch> 

This section needs fleshing out. Anyone with more extensive git knowledge, please help explain things better.

 

Creating a patch for submission

When your work on a local branch is complete, you can create a patch file using the git diff command. Simple run it against the current master and your branch:

git diff master <your-dev-branch>  >patchfilename

You should make sure your master, and branch are completely up-to-date with subversion (using git svn rebase) before creating your patch.

 

Commiting to Subversion

If you have developer privileges to a repository, you can send a group of local git commits into the main subversion repository. Simply run the dcommit command:

git svn dcommit

Note that this will sequentially commit all your local git commits using their commit messages, so make sure you use nice messages, and be prepared for a bunch of outgoing changes! You can clean up in preparation for this step by running

git rebase -i master

This will interactively allow you to coalesce individual commits, up to and including squashing all the commits down to a single one, and also will allow you to rewrite your commit messages before pushing them upstream with dcommit. Note that this alters git history and so is best reserved for completely private branches.

 

 

Working on remote branch (eg tycho-reorg)

git clone git@git.assembla.com:scala-ide.git
# if you get 'Permission denied' errors, try instead:
# git clone git://git.assembla.com/scala-ide.git
cd scala-ide
git checkout -b tycho-reorg origin/tycho-reorg

instruction "git checkout tycho-reorg" create a new local branch off master, not attached to the remote origin/tycho-reorg branch.

git branch
# check tycho-reorg is selected
# do modification
cd org.scala-ide.build
./build-ide-release.sh
cd -
git commit
# to create a patch
git format-patch
# or to push
git push origin tycho-reorg

Recent Versions

Choose two versions to compare, or click the link to view it.

Clear All

History Key

  • New Content
  • Removed content