diff options
author | Kosta Harlan <kostajh@gmail.com> | 2013-09-02 16:30:44 -0400 |
---|---|---|
committer | Kosta Harlan <kostajh@gmail.com> | 2013-09-02 16:30:44 -0400 |
commit | 9b7388a4a748067a2fe631ed15eff1ed8dfdf385 (patch) | |
tree | d48ff2a81f7900b59f531ff04b05db63a3f313c0 | |
parent | 2bbdf4f80969aced6fc5f732cce1fdb0108be7b0 (diff) | |
download | task-git-9b7388a4a748067a2fe631ed15eff1ed8dfdf385.tar.xz task-git-9b7388a4a748067a2fe631ed15eff1ed8dfdf385.zip |
Use existing data dir as repo, update README, and option to push to remote. Fixes #1 and #2
Diffstat (limited to '')
-rw-r--r-- | README.md | 10 | ||||
-rwxr-xr-x | task-git.sh | 18 |
2 files changed, 15 insertions, 13 deletions
@@ -6,11 +6,13 @@ is altered. ## Usage -Add `alias task=/path/to/task-git/task-git.sh` to your `.bashrc` or -`.profile`, and run `chmod +x /path/to/task-git/task-git.sh`. +1. Navigate to your Taskwarrior data directory (usually in `~/.task`) and type `git init`. If you plan to push to a remote, go ahead and add your remote now. +2. Add `alias task=/path/to/task-git/task-git.sh` to your `.bashrc` or +`.profile`. If you want to push to a remote, then the alias should be `alias task=/path/to/task-git/task-git.sh --task-git-push`. Make sure you source the `.bashrc` or `.profile`. +3. Run `chmod +x /path/to/task-git/task-git.sh`. +4. Use `task` as normal; when run, the Taskwarrior database files will be committed to version control. -Backups are generated alongside the existing `.task` database in a new directory -called `.task.bak`. +It is recommended to use the Taskwarrior database only on one machine, as you will be resolving conflicts if using one multiple machines. ## License diff --git a/task-git.sh b/task-git.sh index 24b9f9c..620e197 100755 --- a/task-git.sh +++ b/task-git.sh @@ -10,17 +10,17 @@ if [ ! -d "$DATA_DIR" ]; then echo 'Could not load data directory!' exit 1 fi -# The backup directory is stored alongside the existing data directory. -BACKUP_DIR="${DATA_DIR}.bak" + # Create backups -DATA_DIR_FILES="${DATA_DIR}/*" -mkdir -p $BACKUP_DIR -cp -R $DATA_DIR_FILES "${BACKUP_DIR}/" -cd $BACKUP_DIR -git add . -git commit -m "$TASK_COMMAND" > /dev/null /usr/bin/task $@ -cp -R $DATA_DIR_FILES "${BACKUP_DIR}/" +cd $DATA_DIR git add . git commit -m "$TASK_COMMAND" > /dev/null +# Check if --task-git-push is passed as an argument. +for i +do + if [ "$i" == "--task-git-push" ]; then + git push origin master + fi +done exit 0 |