It has to be said that if you want to contribute to an Open Source project then you will need to deal with Git. So have a look at Git - Reference or Git Reference if you need help as well as NDP Software :: Git Cheatsheet which provides an interesting way to help.

You should also visit Git Immersion - Brought to you by Neo to learn about Git. Another good place to work through is Git Tutorial - Try Git which is from GitHub but should still help.

There are also some very useful links in Development/Git For LibreOffice Developers - The Document Foundation Wiki which will help.


The official website for Git is Git here you will find links to everything you need, including the Release Notes for the latest release. It is worth noting that if this is a security release then it may get backported to older versions, which the latest release note will mention but the earlier ones won't. The release notes can be found at git/Documentation/RelNotes at master · git/git however, do note that the sort order is not by date.

Following on from the Release Notes link you can find all the source code for Git at git/git: Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements. as well as the releases etc.

Git Tips

Write your commit comments in the past tense, when others view them, it will be in the past and when you commit, it will be work you did prior to committing and should be a summary. Some people use a "CATEGORY: message" format, so for example:

BUGFIX: Resolved file error
DOC: Fixed
ENHANCE: Added more cowbell
BUGFIX: fixed crash on http read
CLEANUP: removed old tests

This works well for documentation but limiting the categories obviously helps. In addition it is worth reading How to Write a Git Commit Message.

Git Hosting

Probably the best known is GitHub, however Code, test, and deploy together with GitLab open source git repo management software | GitLab is also a strong contender and has some distinct advantages over GitHub.

Changing Directory Structure

if you need to change your directory structure then do the following:

  • Confirm everything is committed into Git and pushed up to the origin
  • Move your directories and files around
  • git status will reveal what you changed
  • git add --all adds the new directories
  • git commit -m "suitable descriptive message" to commit locally
  • git push to send to code up to the central server
  • All done, check the server's commit and you will see stuff has "moved"

Squashing or Merging

Sometimes when working with GitHub or other git repositories you want to merge your changes into one commit instead of several. Let me explain, in the context of GitHub.
I created a fork of a project, made my changes and submitted a pull request for the repository owner to merge my changes in. However I needed to do a bit more work on the change, so after some comments back and forth with a couple of people I ended up with a number of commits in my fork, which would then, I believe, all appear in the main repository, the owner asked if I could merge/squash these into one commit. So this is what I did:

  • In base/root of my copy execute git log -5, where I had made less than 5 commits
  • Look for the commit before mine and grab its id, c3c8f8ce568114d7aae1ae263e03390617c7c878
  • Then execute git reset c3c8f8ce568114d7aae1ae263e03390617c7c878
  • Now you can update your local repository with git add filename.ext and then git commit
  • Once you have everything checked in locally, execute git log -2 and check it is as expected
  • Next you need to force your changes up with git push --force
This of course makes the assumption there were not other conflicting commits in the mean time.

There is more information on git reset and other similar command at Git checkout | Atlassian Git Tutorial.

I have since discovered that the merging or squashing of commits can be done with git rebase, which is an option worth looking at.


If you do work on the Git server, like creating a Pull Request, merging it and then deleting the source branch you will find your local Git has an orphan branch. The first step is to switch your local Git off this orphan branch and then it is best to delete it. First execute a prune to remove remote tracking references:
git fetch -p
Then list your branches, probably with the verbose option to see more detail:
git branch -vv
Finally once you have found the name of the branch that is no longer on the server you can delete it like this:
git branch -d my-branch-to-delete
Listing the branches again will confirm it has gone. If you want to script a purge of multiple barnches then see Pruning obsolete Git branches for details.

Useful Commands

git checkout ./dir/filename.ext - this is a handy way to undo local changes on a specific file, provided the changes have not been committed
git reset --hard - this undoes all local uncommitted changes, removing any extra files
git bisect - used when you need to find when a bug or change was introduced
git remote -v - shows the remote repositories

GUI Git Tools

The basic, default Git for Windows client does include a GUI, however this is not the case on other platforms. See Git for Windows or further info for Windows and a link to their GitHub repository.

I have been using Visual Studio Code for file editing and as a Git client and I have found it actually works very well. From what I can tell, it does everything you need it to.

Another product a need to try out is Fork - a fast and friendly git client for Mac and Windows, mostly because it was recommended by Scott Hanselman on Twitter but also because many people seem to like it and it is free, so this is definitely something to try out.

I have used SourceTree | Free Git and Hg Client for Mac and Windows a little, it seems to need an Atlassian account to install but after that was fine. In my experience it does not play well behind a proxy server. You might find How to Wipe SourceTree Preferences - Atlassian Documentation handy if you want to reset it.

I have looked at Git Cola: The highly caffeinated Git GUI but it is more difficult to install on Windows as it needs Git for Windows, Python and PyQt. I got as far as needing qmake to install PyQt and gave up!

I am planning to investigate Git GUI Client for Windows Mac and Linux | Axosoft GitKraken but it is only free for non-commercial use on Windows, Mac & Linux. This is the same as Git Client SmartGit, it looks worth trying but is only free for non-commercial use.

For a very basic "diff with Git" then take a look at Meld.

Another interesting looking tools is Sublime Merge - Git, done Sublime however it is not free but does look good. It is made by the same people who make the Sublime Text - A sophisticated text editor for code, markup and prose Editor


A number of companies use Bitbucket - the Git solution for professional teams | Atlassian from Atlassian, which was previously known as Stash. It is a Git server, with a nice browser interface that integrates very well with other Atlassian products like Jira and Confluence.

One issue I found was converting the Bitbucket URL to something command line Git could understand. So for example, let's suppose you have a browser open and are looking at your repository and the URL is this, where PRJ is your project key and REPO the name of the repository in it. This translates to the following Git command:
git clone
Note that at the time of writing whilst a project can have many repositories it is not possible to grab all the repositories in a project with one command or pull/clone.

Helpful Links