Howto setup a pseudo-remote Qt project

If you develop on your own and on just one computer, everything is quite easy: source code in one directory and start developing. First you will make local backups of this directory and after a while you will certainly discover a version control system like git. Later in time you will get a second computer and also want to develop on/in/with the same source code.

Now things tend to get complicated.

If you store the source code on a network share, you can't develop on the computer that can not reach the share (for whatever reason, maybe you are just not at home using your mobile computer). If you use QtCreator as your favorite IDE, you will notice that it stores the personal project settings in a file called *.pro.user and that one does not like to be opened from different computers.

At least since then you need a change in your workflow. Act like the big ones, just for your own: use a central git repository, pull from there, make changes, commit and push up again. Only that up can must not be a server in the internet, it can be a local directory or a network share somewhere in your home environment. Here is how to convert your local git repository to the new central one:

Copy the project directory to some new place (just to be safe). Edit .gitignore file, like e.g.

# Compiled source #
#############
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
#########
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Qt Project files #
####################
*.pro.user*

Delete *.pro.user and *.pro.user.* files from repository if they were committed before.

$ git rm *.pro.user*
$ git commit -m "after deleting *.pro.user* files"

Create remote (central) repository

$ git clone --bare /path/to/your/local/copy/repository /path/to/your/remote/repository.git

Add a reference to the remote (central) repository to your local copy

$ cd /path/to/your/local/copy/repository
$ git remote add origin /path/to/your/remote/repository.git
$ git push --set-upstream origin master

Note that origin is the name referencing your central remote repository. Make local changes and push them with

$ git push origin

Clone repository on other computer:

$ git clone /path/to/your/remote/repository.git

Make local changes, commit and push

$ git commit -a -m "changes I have done"
$ git push origin