Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was wondering if anyone has used Github as a version control system, when writing a large document via TexStudio or TexMaker?

Rstudio for example has a plugin that allows R projects to be pushed and pulled from the Github repository, making it very easy to manage committed changes, and committing them to the actual repo.

Is there a way to achieve this easily with a latex document 'project'.

share|improve this question

1 Answer 1

up vote 10 down vote accepted

You can run custom commands in Texmaker (User -> User Commands) as well as TeXstudio (Configure -> Build -> User Commands). With that it should be possible to call Git command line tools from within the editor. Moreover in TeXstudio, you can combine this with scripting and triggers, which allows you to automatically trigger these actions e.g. on file save.

If you tell me which git commands you need, I could provide example code.


Below is an example for TeXstudio, in which the commands are called via scripting. Create the scripts at User Macros -> Edit Macros.... Since I'm not into git, I don't know if the actual git calls are correct, however it should illustrate the idea.


Git pull command

A simple plain call to an external program. On first execution of the script TXS will ask you if you trust the script to execute external programs.


Git push command

This a bit more fancy. First, the script asks the user for a commit comment. Second, the trigger ?save-file means that the script is called everytime you save a file.

Of course, you can further extend the scripts according to your needs.

share|improve this answer
Thanks, just the standard push / pull and commit functionality.. –  Nicholas Hamilton May 5 '13 at 12:23
I am getting an error being thrown: Not a git repository (or any of the parent directories): .git, but I have set up a .git repository, and can push and pull from command line. –  Nicholas Hamilton May 6 '13 at 16:03
Probably need to set the working directory somehow –  Nicholas Hamilton May 6 '13 at 16:30
There is currently no official way to set the working dir. However, you can try to hack around this: A second argument to runCommand is interpreted as main file of the project and its path is used as working dir. So you can try runCommand("git pull", "d:\\yourpath\\dummy.tex"). - Afaik dummy.tex doesn't even have to exist, but I'm not sure about this. –  Tim Hoffmann May 7 '13 at 17:24
did the trick with: buildManager.runCommand("git push origin master", editor.fileName()) –  Nicholas Hamilton May 7 '13 at 19:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.