Wiki

Clone wiki

DOLFIN / Git cookbook for FEniCS developers

This page lists Git recipes for some common usecases. Please keep the amount of text on this page at a minimum!

Fix an issue (bug)

Create issue branch and fix the issue

git checkout maint # use master if not applicable to maint
git pull
git checkout -b <user>/fix-issue-<number>
<fix the issue>
git commit -m "Fix issue <number>: <Copy-paste title of issue from Bitbucket>"
git push origin <user>/fix-issue-<number>

Merge fix into next for testing

git checkout next
git pull
git merge --no-ff <user>/fix-issue-<number>
git push origin next

Graduate (merge) fix master

<wait for `next` buildbot to say ok>
git checkout master
git pull
git merge --no-ff <user>/fix-issue-<number>
git push origin maint master

Notes

  • Note: Issue branches should be named something like logg/fix-issue-47.

  • Note: Assure that a merge consisting of more commits, especially into master, is non-fast-forward by --no-ff. This results in clearly arranged history.

  • Note: Amend an automatic merge commit by a reason of the merge, especially if merging more than once. This helps others to see what happened.

  • Note: A message of final merge commit (integration) into master should ideally contain a brief summary what is introduced by the merge.

Add a feature

Create topic branch and implement the topic

git checkout master
git pull
git checkout -b <user>/topic-<description>
<hack away, committing regularly>
git push origin <user>/topic-<description>

Merge topic into next for testing

<make merge request, wait for comments, fix according to comments>
git checkout next
git pull
git merge --no-ff <user>/topic-<description>
git push origin next

Graduate (merge) topic into master

<wait for `next` buildbot to say ok>
git checkout master
git pull
git merge --no-ff <user>/topic-<description>
git push origin master

Notes

  • Note: Topic branches should be named something like logg/topic-geometry.

  • Note: Assure that a topic merge, especially into master, is non-fast-forward by --no-ff. This results in clearly arranged history.

  • Note: Amend an automatic merge commit by a reason of the merge, especially if merging more than once. This helps others to see what happened.

  • Note: A message of final merge commit (integration) into master should ideally contain a brief summary what is introduced by the merge.

Handling pull requests

Step 1: Fetch the branch

git fetch git@bitbucket.org:<user>/<repo> <their-branchname>:<user>/<our-branchname>

Example:

git fetch git@bitbucket.org:benjamik/dolfin csg-2d:benjamik/csg-2d

Step 2: Test the branch

git checkout <user>/<our-branchname>
./cmake.local
cd build.<user>.<our-branchname>
make runtests

Step 3: Merge

Merge into next, then into master if successful as described above.

Resetting next after a release

git checkout next
git reset --hard origin/master
git push origin -f next

Miscellaneous

List conflicts

git diff --name-only --diff-filter=U

Clean working directory (use with care)

git clean -fdx

Updated