Browse Source

[add-command] dotgit -- for managing dotfiles repo in $HOME

pull/1/head
Muthu Kumar 7 years ago
parent
commit
5c92b14bb3
  1. 21
      scripts/mkr.sh

21
scripts/mkr.sh

@ -54,6 +54,26 @@ rmd () {
# Git commands # Git commands
## low-level `dot-git-cmd`, to be used for `dotgit` command
alias dot-git-cmd="git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
# Manage dotfiles repo
# Usage: dotgit [commands...]
dotgit () {
if [[ $1 == "-d" || $1 == "--diff" ]]; then
dot-git-cmd diff
elif [[ $1 == "-u" || $1 == "--update" ]]; then
dot-git-cmd add $HOME
dot-git-cmd commit -m date
elif [[ $1 == "-p" || $1 == "--push" ]]; then
dot-git-cmd add $HOME
dot-git-cmd commit -m date
dot-git-cmd push
else
dot-git-cmd $1
fi
}
## pull ## pull
## Usage: pull [remote branch] ## Usage: pull [remote branch]
pull () { pull () {
@ -74,7 +94,6 @@ commit () {
## push ## push
## Usage: push <commit-message> [remote branch] ## Usage: push <commit-message> [remote branch]
## if only commit message is present, pushes to default upstream ## if only commit message is present, pushes to default upstream
push () { push () {
git add . git add .
git commit -m "$1" git commit -m "$1"

Loading…
Cancel
Save