Tag Archives: Git

How to setup a mirror of Qt Project

There is a work from Oswald Buddenhagen, his change, qtrepotools: add mirror script.

Mirror Script

You need to have an account of codereview(gerrit) and set up the ssh keys well, more info in Contribute to Qt.

Here is the qt-codereview-mirror shell script in github.

I set up this mirror script on a Ubuntu 13.04 machine. You need to check following before to run it:

  • Install git and procmail package for git and lockfile:

  • Make sure you have /data/repos directory.

You could have a try run for the above script. If it works well for you, you can add it into your crontab, see also Ubuntu: CronHowto.

Git Daemon

Next is to run a git server on your machine. I use git-daemon for this task.

How to use your mirror?

  • For Qt 4:

If you need to push change to upstream, then you should set up gerrit remote.

  • For Qt 5:

init-repository will help you set up gerrit remote for each repo.

Git中创建空白branch的方法

因为工作需要,要在一个git repo中创建一个空白的branch,就是和其它branch以及revision没有任何关系的branch,公司的git master(一共就两个)帮我搜了搜找到了答案:

Git Community Book: Creating New Empty Branches


git symbolic-ref HEAD refs/heads/newbranch
rm .git/index # windows: del .gitindex
git clean -fdx
#do work#
git add your files
git commit -m 'Initial commit'