simnalamburt / cgitc Goto Github PK
View Code? Open in Web Editor NEW:shipit: Close Git Combat
License: Other
:shipit: Close Git Combat
License: Other
Blockaded by fish-shell/fish-shell#1976, and looks like no one is interested
What's your choice?
fish
abbreviations 파일 안에 들어가는 스크립트가, 모든 쉘에 작동할 수 있는 형태가 아님. 예를들어 $(~~)
이런 코드가 abbreviations 안에 있으면, 그건 fish에서 작동하지 못함.
Fish shell does not have git_current_branch
(I believe this comes from ZSH/Oh-My-ZSH) and hence the abbrs like ggpull
won't really work properly. It could be included in the run.fish
.
(to be completed)
oh-my-zsh의 git 플러그인 기능과, cgitc 자체확장 구분짓기. 지금 abbreviations
파일 안에 ohmyzsh 에서 가져온것과, 자체적으로 확장한것들이 섞여있는데 구분짓고싶다.
grhh
grhh1
gup
gbla
grhh
gup
gbla
#
# cgitc extensions
#
grhh1
git stash save
is deprecated in favour of git stash push
. Currently gsta
is git stash save
, and there is no abbreviation for git stash push
.
cgitc does not automatically setup itself when user clean installs it. It occurs after #15 being merged. 9cb02aa#diff-0545f24fb8f326335e8151d51cbb5c2dR3 seems to cause this bug.
Let's make a video showcase
# Query/use custom command for `git`.
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
: ${_omz_git_git_cmd:=git}
#
# Functions
#
# The name of the current branch
# Back-compatibility wrapper for when this function was defined here in
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
# to fix the core -> git plugin dependency.
function current_branch() {
git_current_branch
}
# The list of remotes
function current_repository() {
if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
return
fi
echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
}
# Pretty log messages
function _git_log_prettily(){
if ! [ -z $1 ]; then
git log --pretty=$1
fi
}
# Warn if the current branch is a WIP
function work_in_progress() {
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
echo "WIP!!"
fi
}
alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
alias gpristine='git reset --hard && git clean -dfx'
compdef gcount=git
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
function gfg() { git ls-files | grep $@ }
compdef gfg=grep
ggf() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force origin "${b:=$1}"
}
compdef _git ggf=git-checkout
ggl() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git pull origin "${*}"
else
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git pull origin "${b:=$1}"
fi
}
compdef _git ggl=git-checkout
alias ggpull='git pull origin $(git_current_branch)'
compdef _git ggpull=git-checkout
ggp() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git push origin "${*}"
else
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git push origin "${b:=$1}"
fi
}
compdef _git ggp=git-checkout
compdef _git ggpush=git-checkout
ggpnp() {
if [[ "$#" == 0 ]]; then
ggl && ggp
else
ggl "${*}" && ggp "${*}"
fi
}
compdef _git ggpnp=git-checkout
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
ggu() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout
alias ggpur='ggu'
compdef _git ggpur=git-checkout
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push=git
compdef _git gk='gitk'
alias gke='\gitk --all $(git log -g --pretty=format:%h)'
compdef _git gke='gitk'
compdef _git glp=git-log
alias gpoat='git push origin --all && git push origin --tags'
compdef _git gpoat=git-push
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
for it in (abbr --list)
abbr --erase "$it"
end
set --erase -U cgitc_initialized
이런식으로 하면 되긴하는데.. 저러면 모든 abbr을 다 지우게되어서 곤란함.
Lines 39 to 40 in 2cb025e
# Abbreviations sorted in alphabetically
function g { git @Args }
function ga { git add @Args }
function gaa { git add --all @Args }
function gapa { git add --patch @Args }
function gau { git add --update @Args }
function gav { git add --verbose @Args }
function gap { git apply @Args }
function gb { git branch @Args }
function gba { git branch -a @Args }
function gbd { git branch -d @Args }
function gbD { git branch -D @Args }
function gbl { git blame -b -w @Args }
function gbnm { git branch --no-merged @Args }
function gbr { git branch --remote @Args }
function gbs { git bisect @Args }
function gbsb { git bisect bad @Args }
function gbsg { git bisect good @Args }
function gbsr { git bisect reset @Args }
function gbss { git bisect start @Args }
function gc { git commit -v @Args }
function gc! { git commit -v --amend @Args }
function gcn! { git commit -v --no-edit --amend @Args }
function gca { git commit -v -a @Args }
function gca! { git commit -v -a --amend @Args }
function gcan! { git commit -v -a --no-edit --amend @Args }
function gcans! { git commit -v -a -s --no-edit --amend @Args }
function gcam { git commit -a -m @Args }
function gcsm { git commit -s -m @Args }
function gcb { git checkout -b @Args }
function gcf { git config --list @Args }
function gcl { git clone --recurse-submodules @Args }
function gclean { git clean -id @Args }
function gcm { git checkout master @Args }
function gcd { git checkout develop @Args }
function gcmsg { git commit -m @Args }
function gco { git checkout @Args }
function gcount { git shortlog -sn @Args }
function gcp { git cherry-pick @Args }
function gcpa { git cherry-pick --abort @Args }
function gcpc { git cherry-pick --continue @Args }
function gcs { git commit -S @Args }
function gd { git diff @Args }
function gdca { git diff --cached @Args }
function gdcw { git diff --cached --word-diff @Args }
function gdt { git diff-tree --no-commit-id --name-only -r @Args }
function gdw { git diff --word-diff @Args }
function gf { git fetch @Args }
function gfa { git fetch --all --prune @Args }
function gfo { git fetch origin @Args }
function gg { git gui citool @Args }
function gga { git gui citool --amend @Args }
function ghh { git help @Args }
function gignore { git update-index --assume-unchanged @Args }
function gk { gitk --all --branches @Args }
function gl { git pull @Args }
function glg { git log --stat @Args }
function glgp { git log --stat -p @Args }
function glgg { git log --graph @Args }
function glgga { git log --graph --decorate --all @Args }
function glgm { git log --graph --max-count=10 @Args }
function glo { git log --oneline --decorate @Args }
function glol { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' @Args }
function glols { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat @Args }
function glod { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' @Args }
function glods { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short @Args }
function glola { git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all @Args }
function glog { git log --oneline --decorate --graph @Args }
function gloga { git log --oneline --decorate --graph --all @Args }
function gm { git merge @Args }
function gmom { git merge origin/master @Args }
function gmt { git mergetool --no-prompt @Args }
function gmtvim { git mergetool --no-prompt --tool=vimdiff @Args }
function gmum { git merge upstream/master @Args }
function gma { git merge --abort @Args }
function gp { git push @Args }
function gpd { git push --dry-run @Args }
function gpf { git push --force-with-lease @Args }
function gpf! { git push --force @Args }
function gpu { git push upstream @Args }
function gpv { git push -v @Args }
function gr { git remote @Args }
function gra { git remote add @Args }
function grb { git rebase @Args }
function grba { git rebase --abort @Args }
function grbc { git rebase --continue @Args }
function grbd { git rebase develop @Args }
function grbi { git rebase -i @Args }
function grbm { git rebase master @Args }
function grbs { git rebase --skip @Args }
function grev { git revert @Args }
function grh { git reset @Args }
function grhh { git reset --hard @Args }
function grm { git rm @Args }
function grmc { git rm --cached @Args }
function grmv { git remote rename @Args }
function grrm { git remote remove @Args }
function grs { git restore @Args }
function grset { git remote set-url @Args }
function grss { git restore --source @Args }
function gru { git reset -- @Args }
function grup { git remote update @Args }
function grv { git remote -v @Args }
function gsb { git status -sb @Args }
function gsd { git svn dcommit @Args }
function gsh { git show @Args }
function gsi { git submodule init @Args }
function gsps { git show --pretty=short --show-signature @Args }
function gsr { git svn rebase @Args }
function gss { git status -s @Args }
function gst { git status @Args }
function gstaa { git stash apply @Args }
function gstc { git stash clear @Args }
function gstd { git stash drop @Args }
function gstl { git stash list @Args }
function gstp { git stash pop @Args }
function gsts { git stash show --text @Args }
function gstall { git stash --all @Args }
function gsu { git submodule update @Args }
function gsw { git switch @Args }
function gswc { git switch -c @Args }
function gts { git tag -s @Args }
function gunignore { git update-index --no-assume-unchanged @Args }
function gup { git pull --rebase @Args }
function gupv { git pull --rebase -v @Args }
function gupa { git pull --rebase --autostash @Args }
function gupav { git pull --rebase --autostash -v @Args }
function glum { git pull upstream master @Args }
function gwch { git whatchanged -p --abbrev-commit --pretty=medium @Args }
#
# cgitc extensions
#
function gbm { git branch -m @Args }
function gcaa { git commit -v -a --amend @Args }
function gdl { git difftool @Args }
function gds { git diff --stat @Args }
function ggpush { git push --set-upstream origin HEAD @Args }
function gp! { git push --force-with-lease @Args }
function grhd { git reset HEAD @Args }
function grhhd { git reset --hard HEAD @Args }
function grhh1 { git reset --hard HEAD~1 @Args }
function gsta { git stash @Args }
function gc- { git checkout - @Args }
It will make cgitc be portable for almost all fish plugin manager.
Fish 2.0.0 support has been accidentally dropped. Let's fix it.
FYI, ubuntu 14.04 LTS is shipped with fish 2.0.0
I think cgitc is awesome enough, worth spreading.
omf update
같은 식으로 업데이트를 해봤자, abbr들이 업데이트되지 않기때문에 문제가 심각함. 지금 당장은 매번 cgitc를 삭제 재설치 하는 방식으로 해결하고있음
문제는 지금 oh-my-fish가 반달리즘으로 날아가버렸기때문에 답이없음. 하.......
abbreviations 파일 안에 들어가는 스크립트가, 모든 쉘에 작동할 수 있는 형태가 아님. 예를들어 $(~~)
이런 코드가 abbreviations 안에 있으면, 그건 fish에서 작동하지 못함.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.