Skip to content

Instantly share code, notes, and snippets.

@marcosbitetti
Created October 15, 2016 21:32
Show Gist options
  • Save marcosbitetti/7bc0226a6d00264014e23a992d3441fd to your computer and use it in GitHub Desktop.
Save marcosbitetti/7bc0226a6d00264014e23a992d3441fd to your computer and use it in GitHub Desktop.
A version control helper to using in Godot Engine
##
# Automatic versioning the code using GIT
# need GIT instaled on OS
func _dev_auto_commit():
if OS.is_debug_build():
var path = '/usr/bin/git'
var finder = File.new()
if not finder.file_exists(path):
if finder.file_exists('/usr/sbin/git'):
path = '/usr/sbin/git'
elif finder.file_exists('/usr/share/bin/git'):
path = '/usr/share/bin/git'
elif finder.file_exists('C:/Program Files (x86)/Git/git.exe'):
path = 'C:/Program Files (x86)/Git/git.exe'
elif finder.file_exists('C:/Program Files/Git/git.exe'):
path = 'C:/Program Files/Git/git.exe'
OS.execute(path, ['add','.'], true)
OS.execute(path, ['commit','-am','Automatic commit from build'], false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment