ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Git Integration: Property Main Branch (Feature #749)

Added by Alf Gaida at 2011-12-02 06:59 am. Updated at 2012-06-05 03:39 pm.

Status:Closed Start date:2011-12-02
Priority:Normal Due date:
Assignee:Felix Schäfer % Done:


Target version:3.2.0
Remote issue URL: Affected version:


There should be a property "Main Branch" for Git Repositories. Master is not in any case the branch i want to show in the repository view. In many cases a branch like stable or current release make more sense.

I have seen this Feature on bitbucket and like it.

Associated revisions

Revision 1722e96b
Added by Justin Geibel at 2012-06-05 03:33 pm

Change default branch behaviour for git repos #749

If git repository HEAD points to a branch, use that as the default branch.
Otherwise fall back to previous method.


Updated by Justin Geibel at 2011-12-02 09:20 pm

If someone can point me in the right direction I might be able to put together a patch for this.

Updated by Toshi MARUYAMA at 2011-12-02 10:59 pm

Bitbucket and github write HEAD file on bare repository.

$ cat HEAD 
ref: refs/heads/master
$ git branch
* master

Updated by Toshi MARUYAMA at 2011-12-02 11:01 pm

$ cat packed-refs 
# pack-refs with: peeled 
1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 refs/heads/latin-1-path-encoding
83ca5fd546063a3c7dc2e568ba3355661a9e2b2c refs/heads/master
67e7792ce20ccae2e4bb73eed09bb397819c8834 refs/heads/test-latin-1
fba357b886984ee71185ad2065e65fc0417d9b92 refs/heads/test_branch
7234cb2750b63f47bff735edc50a1c0a433c2518 refs/tags/tag00.lightweight
1399e2fe59e43d76a15ab922419980d8fa8c9143 refs/tags/tag01.annotated

Updated by Justin Geibel at 2011-12-03 05:18 am

Okay, so I'm thinking about updating the default_branch function so that it calls scm_cmd to run `git symbolic-ref HEAD`. If head points to a branch, this should return something like /refs/heads/master. If head points to a specific SHA then git will return an error so we can fall back to the existing approach.

This has the benefit that I don't have to add a specific setting to the interface for this, but it does require that the user has write access to the HEAD file in order to change the default.

Updated by Justin Geibel at 2011-12-03 10:57 pm

  • Target version set to 2.6.0
  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-12-17 10:40 pm

Gave some feedback on the pull request about adding some tests.

Removing from 2.6.0 until the code is complete and merged.

  • Target version deleted (2.6.0)
  • Status changed from Ready for review to Open

Updated by Felix Schäfer at 2011-12-19 04:22 pm

Looks good so far, I'll probably be able to merge it for 2.6.0.

  • Assignee set to Felix Schäfer
  • Status changed from Open to Ready for review

Updated by Toshi MARUYAMA at 2012-02-12 10:31 am

I implemented in Redmine 1.4.

Updated by Felix Schäfer at 2012-06-05 03:39 pm

Merged in 1722e96, thanks!

  • Status changed from Ready for review to Closed
  • Target version set to 3.2.0

Also available in: Atom PDF