user961091
user961091

Reputation: 11

automatic updating an application with git

is there any way to use git as an automatic updating mechanism for applications. something like what google chrome does (or Github for Mac).

I want to create a central git repo that contains the whole app (including binaries) and be able to make the application pull in changes from the repo in the background. The new version should be installed on the next start.

Thanks

Upvotes: 1

Views: 10223

Answers (5)

Fred Smith
Fred Smith

Reputation: 2129

If you're on Windows machine, you can use my graphic solution

Or create a DOS batch file the way I did it Here is my solution:

    rem first install GIT Bash
rem then add C:\Program Files\Git\bin to the environment variable PATH and reboot you PC
set VisualStudioVersion=2012
set VisualStudioName=Visual Studio %VisualStudioVersion%
cd \
cd %userprofile%
cd "Documents"
cd %VisualStudioName%
cd "Projects"
echo Press a key to update all choosen git repositories if you're in the correct directory otherwise press CTRL-C to cancel
pause
cd AddFeatures
git pull origin master
cd ..
cd CodeGeneration
git pull origin master
cd ..

Upvotes: 0

Eric
Eric

Reputation: 41

I made a java program that uses Git as an autoupdater. What the program does is that it checks the raw text of a CurrentVersion.txt. If the number is greater than the program version, it downloads an updater from the git repo. The updater then acts as a medium between the versions and deleting the old version and replacing it with the newly downloaded one. It was pretty simple.

Upvotes: 4

caarlos0
caarlos0

Reputation: 20643

you always can make a workaround like a text file in server, that will store the last version. On your software startup, download this file, verify if version of file is different from version of installed software, and do the download the new version installer and run it.

is quite simple to implement...

Upvotes: -1

CharlesB
CharlesB

Reputation: 90436

It could look like a good idea, since git is quite efficient at storing files delta, but after it's not: you'd have to embed git with your application. Not sure it is desireable.

Better look at courgette, the Chrome's auto-update mechanism (only for Windows AFIK), and the most voted answers to tag

Upvotes: 0

hoppa
hoppa

Reputation: 3041

Aren't you giving the answer to your own question? Git pull on startup of your application. After a git pull you could run some scripts to execute update-specific actions.

If you've got a webapplication I wouldn't do this on each request to your application, but in a cron job that runs every N minutes.

Upvotes: 0

Related Questions