[Tex/LaTex] TexStudio / TexMaker and Github

gitrevision controltexmakertexstudio

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'?

Best Answer

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.