Skip to content

Latest commit

 

History

History
71 lines (45 loc) · 2.33 KB

README.textile

File metadata and controls

71 lines (45 loc) · 2.33 KB

Introduction

A simple tool to wrap some git commands to managed files distributed in different directories. The most possible scenario is, there are configuration files distributed in various directories which need to backup during server setup.
The basic idea is copying the files into a central directory and keep its original path information, then use git to add, commit and push.

This script only test in Linux and OSX.

Warning: It may have security risks since all files are put into same repository, suggest use sudo on all commands.

Prerequisite

Python +2.7 or +3.1

Installation

sudo pip install git+https://github.com/GeniusWiki/dgm.git

Quick start

dgm add file_name
dgm monitor dir_name
dgm checkin .
dgm status

Usage

Initialise DGM repository under ~/xdev/dgm directory. Meanwhile, default DGM configuration file is created under user home directory ~/.dgm.

dgm init -n ubuntu -d ~/xdev/dgm [-s gitRemoteURL]

Add new files to DGM repository, file could be with relative or absolute path. After add, there is git commit immediately. Warning, commit will for all staging changes not this new added file.
dgm add nagios3 [ /etc/init.d/tomcat.sh ~/nginx.conf]

Check DGM repository and git status
dgm status [-a]
-a: List all files in DGM repository

Copy source files to DGM repository. The files must already exited in DGM (dgm add command).
dgm checkin [-f]
-f Force to check into DGM even the DGM file is newer than source file

Commit DGM repository file into local git.
dgm commit -m’some comment’

Push DGM repository to remote git. if not set gitRemoteURL, then use dgm remote -a to set before this command.
dgm push

Pull from remote git
dgm pull

Rmove file from DGM repository
dgm rm nagios3 [ /etc/init.d/tomcat.sh ~/nginx.conf]

Apply DGM managed file into local. This will overwrite local file without warning!!!
dgm apply [-f]
-f Force to overwrite source file from DGM repository even source file is newer than DGM file

Add remote git URL – if it already has, failed.
dgm config [add -s gitRemoteURL]
- Print DGM configuration information
- add git remote URL – no implemented

dgm diff

TODO:

  • Group of servers, and manage files in group level
  • Check-in and check-out in different server(?)
  • Keep owner information