Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Submodules (Git)

From TYPO3Wiki
Jump to: navigation, search

Introduction 

Git submodules are used in the TYPO3 Core for several system extensions, namely:

  • dbal
  • extbase
  • fluid
  • linkvalidator
  • version
  • workspaces

Working properly with Git submodules requires some additional knowledge. First of all make sure to have set up your environment properly, as explained in the contribution walkthrough. Please mind particularly the points about submodules.

Moving to a submodule

If you navigate through the TYPO3 source code down to a system extension managed as a Git submodule, you will arrive there in a perfectly transparent manner. However you will notice that the folder contains a ".git" file. Now check the local Git branches:

git branch

The result will be:

* (no branch)
master

Note that you are on no branch at all. This is called a "detached HEAD". You should not do any work at all while in this state! To check out what branches are available from the remore repository, type:

git branch -a

For the "dbal" system extension, for example, the result will be:

* (no branch)
master
remotes/origin/DBAL_0-9
remotes/origin/DBAL_1-0
remotes/origin/DBAL_1-1
remotes/origin/DBAL_1-2
remotes/origin/HEAD -> origin/master
remotes/origin/incubation_DBAL2
remotes/origin/master

Creating a local branch

The next step is to create a local branch to work in. You probably want to track a specific remote branch, so you could use a command like:

git checkout -b issueXYZ remotes/origin/DBAL_1-2

You can then work in this branch.

Pushing a changeset

Before pushing a change for review, check that your environment is indeed well set up:

git remote -v

should result in something like:

origin git://git.typo3.org/TYPO3CMS/Extensions/dbal.git (fetch)
origin ssh://username@review.typo3.org:29418/TYPO3CMS/Extensions/dbal.git (push)

The important line is the second one, which indicates that changes will be pushed to Gerrit (review.typo3.org).

You can then proceed and push your changes as usual:

git push origin HEAD:refs/for/[branch]/[topic]

If you are unsure what refs exist for the remotes of this particular project, type:

git branch -r
git show-ref | grep origin

For the workspaces projects, this will result in:

4.5
HEAD
master

Having problems?

Try the Troubleshooting page, there are some answers which are specific to the use of Git submodules.