You are currently browsing documentation for Diem 5.1 - Switch to version5.0

Use Git

Git is the best way to get Diem

Use Git to get the code

Clone Diem repo on your computer

The first thing to do is to copy the Diem repo to your computer.

git clone git:// --recursive  
cd diem  

Now, you have to choose a branch, like 5.0 or 5.1.

Checkout a branch


If you want to use Diem 5.0, create the appropriate branch in your repo.

git checkout -b 5.0 origin/5.0  

This command creates the branch 5.0 in your repo, and makes it track the server 5.0 branch.
It gives you the latest version of the 5.0 branch (5.0.3 when I write these lines).


If you want to use Diem 5.1, create the appropriate branch in your repo.

git checkout -b 5.1 origin/5.1  

This command creates the branch 5.1 in your repo, and makes it track the server 5.1 branch.
It gives you the latest version of the 5.1 branch (5.1.0-BETA2 when I write these lines).

Get submodules

External libraries, like symfony, are bundled as submodules. This is roughly equivalent to svn externals.

Create submodules

The first time you checkout a branch, you have to initialize its submodules.

git submodule init  

Update submodules

To get or update the submodules, run:

git submodule update  

Manage your branches

To see the branches you have, run

git branch  

It shows the local branches of your repo:

* 5.1  

The * means you are currently on the 5.1 branch. To switch to the 5.0 branch, run

git checkout 5.0  

Upgrade Diem

To upgrade your local Diem to the latest server version of your current branch, run

git pull  

Use Git to contribute

Thanks to Git and GitHub, it's very easy to contribute to Diem code or documentation.

Get a GitHub account

It's free:
In this doc I'll consider your GitHub username is "marcel".

Fork diem-project/diem repo

Go on and click the Fork button.
You now have a copy of the repository in your GitHub account, at
You can do whatever you want on this repo. Later, you can request to merge your changes in the official diem/project/diem repo.

Clone your forked repo on your computer

Clone your forked repo on your computer:

git clone  
cd diem  
git submodule init  
git submodule update  

Change branch

Firstly, create the branch you want to work on. Let's suppose you're interrested in working on the 5.1 branch.

git checkout -b 5.1 origin/5.1  

Here, origin/5.1 represents your forked repo 5.1 branch.
You now have a 5.1 local branch that tracks your remote 5.1 branch.

Push to your forked repo

Make some commits locally, then push to your GitHub forked repo:

git push origin 5.1  

Get latest updates from diem-project repo

The official Diem repo is updated frequently, don't forget to retrieve changes.

Add the diem-project official remote repo

You already have your own remote, named "origin". It's a shortcut to
Add the official repo with this command:

git remote add official git://  

You now have two remotes. Your forked repo, known as "origin", where you can push.
And the official repo, from where you can only pull.
To see the remotes, you can run

git remote -v  

Pull from the diem-project repo

To get latest updates from diem-project official repo, run:

git pull official 5.1  

Contribute to the diem-project repo

If you feel happy with your changes and want to include them in Diem, push your changes to your GitHub repo with

git push origin 5.1  

Then on your GitHub page ( click the "Pull request" button.
We will examine your changes quickly.
This is the very best way to contribute to Diem development, and makes us very, very happy.

Contribute to Diem documentation

Diem documentations have a GitHub repository, too:
You can fork it to contribute, the same way. It makes us happy too.

Questions and Feedback

If you need support or have a technical question, you can

  • Get help with the Google Group
  • Get help with the Forum
  • Come and chat on the #diem IRC channel on freenode

The documentation is hosted on GitHub. Feel free to submit issues and patches!

Fork Diem on GitHub