Using TeXstudio and git to automatically commit using the current date
I found a solution to this problem with the following steps:
- Create a batch file in the directory of your main
*.tex
file - Open the batch file and add the following line:
git commit -am "autosave %date%-%time:~0,8%"
. This will commit all changes made (-a
switch) and set the commit message to e.g.autosave 2015-08-17-09:34:05
- Add a custom command in TeXstudio that executes your batch script (see image below for an example)
- Add your custom command to the list of commands for compilation
- After the next compilation of the document, the following message will appear in the message log:
- Additionally, the batch file could be modified accordingly to push the changes directly to the remote repository via
git push
Try to work with git as described here - citated:
Use git
instead of svn
. So you have to change the commands for using git
via svn
-commands at Options->Configure TeXstudio → Commands → SVN and SVNADMIN to git
.
Then open bash and tell git to use the command ci
:
git config --global alias.ci "commit"
There you go. Now you can enable auto-commit at Options → Configure TeXstudio → SVN.
Be advised that these automatic checkins will clutter your repository. It may be a good idea to switch to a different branch before working with TeXstudio and pick/squash the changes to the master branch after you are done.