Created
January 1, 2011 15:40
Revisions
-
tomster revised this gist
Jan 1, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ #!/usr/bin/env python # encoding: utf-8 @@ -19,9 +18,10 @@ def main(): if path.exists(target_path): exit("Directory already exists at %s, not touching it!" % target_path) mkdir(target_path) repo_path = path.abspath('.git') whereami = getcwd() chdir(target_path) symlink(repo_path, '.git') chdir(whereami) print("Created symlink at %s" % target_path) -
tomster created this gist
Jan 1, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/usr/bin/env python # encoding: utf-8 """ Create a symlink of the current .git inside your Dropbox, now all your local commits will automatically be backed up to Dropbox (without your dropbox being littered with development cruft, like temporary build files) """ from os import getcwd, path, mkdir, symlink, chdir DROPBOXREPOBASE=path.expanduser('~/Dropbox/Development/git-repos/') def main(): if not path.exists('.git'): exit("No .git found in current directory.") parent = path.split(path.abspath('.'))[-1] target_path = path.join(DROPBOXREPOBASE, parent) if path.exists(target_path): exit("Directory already exists at %s, not touching it!" % target_path) mkdir(target_path) whereami = getcwd() chdir(target_path) symlink(path.abspath('.git'), '.git') chdir(whereami) print("Created symlink at %s" % target_path) if __name__ == '__main__': main()