add_github_remote.

This commit is contained in:
Ivan Malison 2015-07-21 16:51:23 -07:00
parent 1d925784b4
commit 1ce47d897d
2 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@
ffo = !git ffr origin ffo = !git ffr origin
ffr = "!ffr() { git fetch $1 && git ff $1/$(git which-branch) && git suir; }; ffr" ffr = "!ffr() { git fetch $1 && git ff $1/$(git which-branch) && git suir; }; ffr"
file-exists = "!f() { git ls-files $1 --error-unmatch > /dev/null 2> /dev/null; }; f" file-exists = "!f() { git ls-files $1 --error-unmatch > /dev/null 2> /dev/null; }; f"
add-gh-remote = "! add_github_remote"
icd = "!d() { git difftool --no-prompt --extcmd 'icdiff' $@ | $(git config --get core.pager); }; d" icd = "!d() { git difftool --no-prompt --extcmd 'icdiff' $@ | $(git config --get core.pager); }; d"
icdl = "!d() { git difftool --no-prompt --extcmd 'icdiff --line-numbers' $@ | $(git config --get core.pager); }; d" icdl = "!d() { git difftool --no-prompt --extcmd 'icdiff --line-numbers' $@ | $(git config --get core.pager); }; d"
ignore = "!i() { printf \"\n$1\" >> "`git root`/.gitignore"; }; i" ignore = "!i() { printf \"\n$1\" >> "`git root`/.gitignore"; }; i"

View File

@ -390,3 +390,13 @@ function pkill_zsh {
function find_by_size { function find_by_size {
find . -type f -size +$1 find . -type f -size +$1
} }
function get_git_project_name {
# "$(basename $(git rev-parse --show-toplevel))"
basename $(git remotes | get_cols 2)
}
function add_github_remote {
local project_name="$(get_git_project_name)"
git remote add "$1" "git@github.com:$1/$project_name"
}