[TYPO3-core] [GIT] Best practice with daily tasks

Stefano Kowalke blueduck at gmx.net
Tue Mar 1 22:09:01 CET 2011

Hey Steffen,

> What you describe is pushing into a branch. This means the remote branch.
> (is this allowed with gerrit?)

You push into ":refs/for/<branchname>". This is a pseudobranch which
only exist in gerrit. If you push into this pseudobranch, the commit
will be pass to gerrit and if the patch is ok, gerrit knows in which
branch this shall be merged (refs/<branchname>).

What Peter means, it that is doesn't matter on which branch you working
local. _You_ specify in which branch it shall go on remote. So you can
work on master and push it into a feature branch.

> Let's say, i did some changes in my local master. Now i want to commit
> it into a new branch. Long way would be:
> checkout to a new branch
> merge master into this branch
> commit

No. This makes no sense, because master and branch are the same, if you
branch from master.

Let say you want fix a bug with number 123 and you have only master as
local branch:

$ git branch
* master

Then create a new branch from master:
$ git checkout -b bugfix_123 master

Now you are on the bugfix branch:
$ git branch
* bugfix_123

Fixing the bug .... takes some while ....
(While you fixing the bug you can commit your changes right into the
bugfix branch)

When you thing your are finished.

Push this branch to gerrit (this works only if you setup a remote for
$ git push for-master

Now you and the reviewer can vote for the patch.

*Skip section about review process*

If the patch is ok, gerrit merge it with the tree. And you can delete
your local bugfix branch and do a
$ git rebase
$ git pull

(I am not sure about this)

Now your local repo is synced with the remote repo.

Hope this helps.

More information about the TYPO3-team-core mailing list