Viewers:Source Code

From InWorldz Wiki
Jump to: navigation, search

Main Page

History | Founders | Mentors | Community | Knowledge Base | Land | Tutorials | Scripting | Building | Viewers | Server Code Changes

InWorldz Viewer Source Code

InWorldz uses LF (Unix) line endings
Make sure that's what you're using when you
clone/push or you'll cause merge conflicts

Source for the InWorldz Viewer can be obtained two ways:

git clone git://

in the command prompt. This will create a git repository in your current directory. Note that git repos contain both the source and all past and current revisions, but you will only work in one branch at a time. To change branches or versions, you can use the git checkout command like so:

git checkout next

This will change your current branch to the "next" branch. To checkout a version, you can use its tag. For example:

git checkout v1.2.6.2

will checkout the source for version

How To Use Git

Downloading Git


Optional: QGit

QGit is a fairly good graphical interface for Git. It's limited in functionality compared to using the command line, but perhaps friendlier to use. One nice thing is that you can add custom "Actions" to perform commands that it doesn't have built in.

Optional: TortoiseGit

Windows only, gui-based git interface based on TortoiseSVN. 32 bit and 64 bit versions available.

Downloading the Source

The first step to getting the source is to clone the repository. It's called "cloning" because you actually download a copy of the entire repository, including all past and present revisions. That makes the initial download take a little while, but the advantage is that you can then access the entire history of all branches of the source, very quickly, without need for an internet connection. It also allows you to make your own changes without disturbing anyone else's repositories.

The clone URL for the official InWorldz repository is git://

You can clone it from the command line like this:

git clone git://

The results will go into a directory called "InWorldz-Viewer".

Switching Branches

The cloned repository contains multiple branches. Each branch contains its own history of changes. Developers can create a new branch and work on it without disturbing any other branches, then merge that branch into another branch to combine them. In git, we make new branches to fix a bug or implement a new feature, then merge them back into the "next" branch when they are done.

It's important to understand that in Git, you only see the files for one branch at a time. The InWorldz-Viewer directory and its sub-directories show the source code and other files as they exist in the branch you are currently viewing. By default, that's the "master" branch, which contains the files for our most recent release.

The term Git uses for this is checking out a branch. You can check out the "next" branch from the command line like this:

git checkout next

(You can use any other branch name in place of the word "next" to switch to that branch instead. To see a list of branches, use git branch)

When you check out another branch, it changes all the project files to match how they exist on that other branch.

Updating Your Repository

Over time, your repository will start to get out of date, because the updates we make to the official repository aren't automatically downloaded to yours. To download the updates, use:

git fetch origin

This means to fetch (download) the updates from the origin (the repository you made the clone of, i.e. the official repository). However, this doesn't automatically apply the updates to your copies of the branches. To do that, use:

git merge origin/next

This merges (combines) the "next" branch that you downloaded from the origin with the branch you are currently visiting. That will bring your branch up to date.

Contributing Code Using Git

In order to get you contributions back into the official InWorldz repository, go to, create an account for yourself, then use the fork button on the project page to fork the repository.

Then you need to set up SSH so you can push to your Github repository from your local repository. Github gives instructions for MS Windows, Linux, or Mac.

Then back in your local repository, add your new Github fork as a remote

 git remote add mygithub

where MyGithub is your Github ID. While you're in your working tree, push your local changes to your Github repository

 git push mygithub next

Then create a pull request.

Git For SVN Users

If you're used to SVN, these guides should help you acclimate to git:

Further Reading

More advanced: