diff --git a/docs/Bash.md b/docs/Bash.md
index 0123ed4..a1e3dc6 100644
--- a/docs/Bash.md
+++ b/docs/Bash.md
@@ -31,10 +31,10 @@
* *oo* → open .
-* *marked* → open -a marked
-
* *e* → subl
+* *gh* → github
+
* *+x* → chmod +x
* *md
* → Make directory and `cd` to it.
diff --git a/docs/Git.md b/docs/Git.md
index 73d94ff..baaa541 100644
--- a/docs/Git.md
+++ b/docs/Git.md
@@ -32,27 +32,15 @@ Simple one-line-per-commit log.
Log with list of changed files for each commit.
-### git ignore
-
-Add new item to `.gitignore`.
-
-### git this
-
-Initialize Git repo in current folder and commit all files.
-
-### git append
+### git-append
Add all staged files to previous commit.
-### git undo
-
-Undo last commit withould loosing any changes.
-
-### git conflicts
+### git-conflicts
List of files with unresolved conflicts.
-### gr
+### git-root (or gr)
Jump to root folder of Git repo.
@@ -70,7 +58,7 @@ Add remote upstream.
### git-upstream [branch]
-Sync branch with upstream.
+Sync branch (`master` by default) with upstream.
## [git-friendly](https://github.com/jamiew/git-friendly)
diff --git a/includes/bash_aliases.bash b/includes/bash_aliases.bash
index 3f93d04..8c86ccb 100644
--- a/includes/bash_aliases.bash
+++ b/includes/bash_aliases.bash
@@ -15,7 +15,7 @@ alias pjm="cd ~/Dropbox/Projects/!"
alias o="open"
alias oo="open ."
alias e="subl"
-alias marked="open -a marked"
+alias gh="github"
alias +x="chmod +x"
# Detect which `ls` flavor is in use
@@ -82,9 +82,6 @@ password() { openssl rand -base64 ${1:-8} | c; }
# Show $PATH in a readable way
alias path='echo -e ${PATH//:/\\n}'
-# Git root
-alias gr='git rev-parse 2>/dev/null && cd "./$(git rev-parse --show-cdup)"'
-
# NPM
alias npm-patch='npm version patch -m "%s"'
alias npm-release='npm version minor -m "%s"'
diff --git a/includes/bash_functions.bash b/includes/bash_functions.bash
index b84a016..9f3258d 100644
--- a/includes/bash_functions.bash
+++ b/includes/bash_functions.bash
@@ -141,45 +141,6 @@ function yay() {
fi
}
-# Setup syncronization of current Git repo with GitHub repo of the same name
-# USAGE: git-github [repo]
-function git-github() {
- user="sapegin"
- repo=${1-`basename "$(pwd)"`}
- git remote add origin "git@github.com:$user/$repo.git"
- git push -u origin master
-}
-
-# Setup syncronization of current Git repo with Bitbucket repo of the same name
-# USAGE: git-bitbucket [repo]
-function git-bitbucket() {
- user="sapegin"
- repo=${1-`basename "$(pwd)"`}
- git remote add origin "git@bitbucket.org:$user/$repo.git"
- git push -u origin master
-}
-
-# Add remote upstream
-# USAGE: git-fork
-function git-fork() {
- user=$1
- if [[ "$user" == "" ]]; then
- echo "Usage: git-fork "
- else
- repo=`basename "$(pwd)"`
- git remote add upstream "git@github.com:$user/$repo.git"
- fi
-}
-
-# Sync branch with upstream
-# USAGE: git-upstream [branch]
-function git-upstream() {
- branch=${1-master}
- git fetch upstream
- git checkout $branch
- git merge upstream/$branch
-}
-
# Find files with Windows line endings (and convert then to Unix in force mode)
# USAGE: crlf [--force]
function crlf() {
diff --git a/includes/bash_git.bash b/includes/bash_git.bash
new file mode 100644
index 0000000..f17262b
--- /dev/null
+++ b/includes/bash_git.bash
@@ -0,0 +1,56 @@
+# Git related Bash aliases
+
+github_user="sapegin"
+bitbucket_user="sapegin"
+
+
+# `cd` to repo root
+alias git-root='git rev-parse 2>/dev/null && cd "./$(git rev-parse --show-cdup)"'
+alias gr="git-root"
+
+# Setup syncronization of current Git repo with GitHub repo of the same name
+# USAGE: git-github [repo]
+function git-github() {
+ local repo=${1-`basename "$(pwd)"`}
+ git remote add origin "git@github.com:$github_user/$repo.git"
+ git push -u origin master
+}
+
+# Setup syncronization of current Git repo with Bitbucket repo of the same name
+# USAGE: git-bitbucket [repo]
+function git-bitbucket() {
+ local repo=${1-`basename "$(pwd)"`}
+ git remote add origin "git@bitbucket.org:$bitbucket_user/$repo.git"
+ git push -u origin master
+}
+
+# Add remote upstream
+# USAGE: git-fork
+function git-fork() {
+ local user=$1
+ if [[ "$user" == "" ]]; then
+ echo "Usage: git-fork "
+ else
+ local repo=`basename "$(pwd)"`
+ git remote add upstream "git@github.com:$user/$repo.git"
+ fi
+}
+
+# Sync branch with upstream
+# USAGE: git-upstream [branch]
+function git-upstream() {
+ local branch=${1-master}
+ git fetch upstream
+ git checkout $branch
+ git merge upstream/$branch
+}
+
+# Add all staged files to previous commit
+function git-append() {
+ git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
+}
+
+# List of files with unresolved conflicts
+function git-conflicts() {
+ git ls-files -u | awk '{print $4}' | sort -u
+}
diff --git a/tilde/bash_profile.bash b/tilde/bash_profile.bash
index 0e165ea..7bb0cad 100644
--- a/tilde/bash_profile.bash
+++ b/tilde/bash_profile.bash
@@ -61,8 +61,8 @@ INVERT="$(tput sgr 1 0)"
NOCOLOR="$(tput sgr0)"
# Load prompt and aliases
-for file in ~/dotfiles/includes/{bash_prompt,bash_aliases,bash_functions}; do
- [ -r "$file.bash" ] && source "$file.bash"
+for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git}.bash; do
+ [ -r "$file" ] && source "$file"
done
unset file
diff --git a/tilde/gitconfig b/tilde/gitconfig
index 7ba00cc..398f4bd 100644
--- a/tilde/gitconfig
+++ b/tilde/gitconfig
@@ -27,11 +27,6 @@
s = status -sb
l = log --graph --pretty=format:'%C(magenta)%h%C(blue)%d%Creset %s %C(blue bold)- %an, %ar%Creset'
ll = log --stat --abbrev-commit
- ignore = !([ ! -e .gitignore ] && touch .gitignore) | echo $2 >> .gitignore
- this = !git init && git add . && git commit -m \"Initial commit.\"
- append = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
- undo = reset --mixed HEAD^
- conflicts = !git ls-files -u | awk '{print $4}' | sort -u
[push]
default = current