Created
October 23, 2012 01:14
-
-
Save yonchu/3936073 to your computer and use it in GitHub Desktop.
Gitリポジトリの色んな情報を表示. どんなリポジトリなのかを瞬時に把握するのに便利
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 実行イメージ | |
| $ gits | |
| ===== git status -sb ===== | |
| ## master | |
| ===== git submodule status ===== | |
| ## submodule | |
| a60663b02cd3b75793a82dd2050d96cd86c22ede .tmux/tmux-powerline (heads/master) | |
| d6cccfe6eb1c2f1e541955935f95f9e6152f2097 .tmux/tmux-powerline-wrapper (heads/master) | |
| f7c0f031cab5eca993e517200df68e43184ffcbf .zsh/functions/Completion/zsh-completions (0.3.0-89-gf7c0f03) | |
| dfd4308ae84da481f774b3f5e732ee277d9d8769 .zsh/z (v1.4-2-gdfd4308) | |
| 45194671af8e1d6b37b16e214a58674762ab8e49 .zsh/zsh-syntax-highlighting (0.1.2-2-g4519467) | |
| 1582b6a89008d5298a95f99d8de8f09b75994a1e .zsh/zsh-vcs-prompt (heads/master) | |
| ===== git remote show orign (simple) ===== | |
| (local out of date) https://github.com/erikw/tmux-powerline.git | |
| (up to date) https://github.com/yonchu/tmux-powerline-wrapper.git | |
| (up to date) https://github.com/zsh-users/zsh-completions.git | |
| (up to date) git://github.com/rupa/z.git | |
| (up to date) https://github.com/yonchu/zsh-syntax-highlighting.git | |
| (local out of date) https://github.com/yonchu/zsh-vcs-prompt.git | |
| ===== git remote -v ===== | |
| github git@github.com:yonchu/dotfiles.git (fetch) | |
| github git@github.com:yonchu/dotfiles.git (push) | |
| origin /Users/yonchu/Dropbox/Repos/git/dotfiles.git (fetch) | |
| origin /Users/yonchu/Dropbox/Repos/git/dotfiles.git (push) | |
| ===== git branch -av ===== | |
| * master 9efa208 Add submodule zsh-vcs-prompt. Delete zsh-git-prompt. | |
| remotes/github/master 9efa208 Add submodule zsh-vcs-prompt. Delete zsh-git-prompt. | |
| remotes/origin/HEAD -> origin/master | |
| remotes/origin/master 9efa208 Add submodule zsh-vcs-prompt. Delete zsh-git-prompt. | |
| ===== git stash list ===== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if ! type git > /dev/null 2>&1; then | |
| echo 'Error: Git is not installed.' 2>%1 | |
| exit 1 | |
| fi | |
| if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" != "true" ]; then | |
| echo 'Error: Not a git repository' 2>&1 | |
| exit 1 | |
| fi | |
| echo "===== git status -sb =====" | |
| git status -sb | |
| ( | |
| cd "$(git rev-parse --show-toplevel)" >/dev/null 2>&1; | |
| echo "===== git submodule status =====" | |
| sub_state=$(git submodule status) | |
| if [ -n "$sub_state" ]; then | |
| echo -e '## \033[0;34msubmodule\033[0;39m' | |
| echo "$sub_state" | |
| echo "===== git remote show orign (simple) =====" | |
| cmd="git remote show origin| tail -1 | sed 's/.*\((.*)\)/\1/' | tr '\n' ' ' && git remote -v | head -1 | tr '\t' ' ' | cut -d' ' -f 2" | |
| status=$(git submodule foreach "$cmd") | |
| echo "$status" | sed '/^Entering/d' | |
| fi | |
| ) | |
| echo "===== git remote -v =====" | |
| git remote -v | |
| echo "===== git branch -av =====" | |
| git branch -av | |
| echo "===== git stash list =====" | |
| git stash list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment