From 263db6d13b625ac1d335f05a5e808758250b730c Mon Sep 17 00:00:00 2001 From: mapperr Date: Wed, 14 Apr 2021 12:40:27 +0200 Subject: [PATCH] Add sync --- README.md | 2 ++ dfl | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 3e01a98..82a54d3 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,8 @@ For example, you can hack your `~/.vimrc` and do: `dfl g commit -am 'Add awesomeness' && dfl g push` +or `dfl sync`, or just `dfl y` + from wherever you are. Handy, isn't it? : ) ### Jumping and dotfiles path diff --git a/dfl b/dfl index 09404c6..a477510 100755 --- a/dfl +++ b/dfl @@ -259,6 +259,9 @@ Commands: g, git [git_arguments] runs git commands in the dotfiles directory + y, sync + commits changes, pulls and pushs current branch + clone clone a git repo in the dotfile directory, backupping the eventual existing one @@ -380,6 +383,12 @@ elif [ "$command" = "u" ] || [ "$command" = "up" ] || [ "$command" = "update" ]; write_update_script exec /bin/bash "$update_scriptpath_abs" +elif [ "$command" = "y" ] || [ "$command" = "sync" ]; then + cd $dotfiles_dir_abs + git status | grep 'nothing to commit' &>/dev/null + test $? = 1 && git add -A && git commit -am 'sync' + git pull && git push + else helpmsg fi -- 2.45.2