目次
- 1 ドキュメント
- 2 まとめ
- 3 git show コマンド
- 4 git am コマンド
- 5 git rev-parse コマンド
- 6 現在のブランチ名を取得する
- 7 git show-branch コマンド
- 8 git describe コマンド
- 9 git name-rev コマンド
- 10 git cherry コマンド
- 11 git symbolic-ref コマンド
- 12 git rev-list コマンド
- 13 リモートリポジトリから特定のコミットを取得する
- 14 コミットメッセージを取得する
- 15 git stripspace コマンド
- 16 コマンド補完
- 17 git-completion.bash
- 18 git-prompt.sh
ドキュメント
参考:
まとめ
参考:
git show コマンド
参考:
How to get the commit info of a changeset – Stack Overflow
git-show Documentation | Git [Official]
git am コマンド
参考:
git am で他人のコミットをパッチとして当てる方法 – Qiita
git-am Documentation | Git [Official]
git rev-parse コマンド
短縮ハッシュを得る
$ git rev-parse --short HEAD
参考:
git rev-parse でできること | 長生村本郷 Engineers’Blog
git で任意のブランチのハッシュ値を取得 | ヤルキデナイズドだった
git-rev-parse Documentation | Git [Official]
What does git rev-parse do? – Stack Overflow
現在のブランチ名を取得する
$ git rev-parse --abbrev-ref HEAD
参考:
git rev-parse コマンド | 酒と涙とRubyとRailsと
シェルスクリプトで現在のブランチ名を取得する | ペンギン村 Tech Blog
Gitリポジトリのカレントブランチ名を取得する | blog: takahiro okumura
git で現在のブランチ名を取得する | 技術は熱いうちに打て!
git current-branch で現在のブランチ名を返す | There’s an echo in my head
How to get the current branch name in Git? – Stack Overflow
git show-branch コマンド
参考:
Git で今のブランチの派生元ブランチを特定する – Qiita
git describe コマンド
$ git describe --all HEAD
参考:
git-describe Documentation | Git [Official]
git name-rev コマンド
HEAD
が属するブランチを表示する
$ git name-rev --name-only HEAD
master
からの相対位置を表示する
$ git name-rev --refs master commit
参考:
git で指定したコミットがどのブランチに属するか知りたい | QA@IT
Git でコミットの親子関係を master からの相対距離で調べる方法 | @kyanny’s blog
git-name-rev Documentation | Git [Official]
What does git name-rev do? – Stack Overflow
Print symbolic name for HEAD – Stack Overflow
How to get the current branch name in Git? – Stack Overflow
git cherry コマンド
参考:
git cherry でブランチ間のコミットの diff を。色もつけて | ゆるよろ日記
git-cherry Documentation | Git [Official]
git symbolic-ref コマンド
$ git symbolic-ref --short HEAD
参考:
リポジトリのカレントブランチ名を取得する | blog: takahiro okumura
git のカレントブランチをコピーするワンライナー – Qiita
git symbolic-ref を利用して、ブランチに対して別名をつけることができて墓ドル | ゆるよろ日記
Git のブランチに別名をつける symbolic-ref | 誰得UNIX
Git リモートリポジトリのHEADのブランチを変更する – Qiita
git-symbolic-ref Documentation | Git [Official]
git rev-list コマンド
$ git rev-list --format=%s --max-count=10 HEAD
参考:
Print commit message of a given commit in git – Stack Overflow
git-rev-list Documentation | Git [Official]
リモートリポジトリから特定のコミットを取得する
参考:
リモートブランチから特定のコミットだけを取得する – Qiita
Retrieve specific commit from a remote Git repository – Stack Overflow
コミットメッセージを取得する
git show
コマンドを使う
$ git show -s --format=%s HEAD
git log
コマンドを使う
$ git log -1 --format=%s | cat
参考:
Print commit message of a given commit in git – Stack Overflow
How to read last commit comment? – Stack Overflow
git stripspace コマンド
参考:
git-stripspace Documentation | Git [Official]
コマンド補完
参考:
入力補完を設定して、Git をより高速に利用しよう | YoheiM .NET
「Git 補完をしらない」「git status を1日100回は使う」そんなあなたに朗報 git-completion と git-prompt – Qiita
Git コマンドをタブキーで補完できるようにする | mawatari.jp
Bash で Git を使う | Pro Git book [Official]
Why ‘git ls-files’ is not shown on tab completion? – Stack Overflow
git-completion.bash
Homebrew で Git をインストールすると $(brew --prefix)/etc/bash_completion.d
ディレクトリ内に git-completion.bash
へのシンボリックリンクが作成される。
Homebrew で bash-completion@2
をインストールする。(Bash 4 以降が必要。Bash 3 以前を使用の場合は v1 をインストールする。)
$ brew install bash-completion@2
.profile_bash
で bash_completion.sh
を読み込む。BASH_COMPLETION_COMPAT_DIR
を定義して$(brew --prefix)/etc/bash_completion.d
以下にある v1 互換の補完スクリプトを読み込ませる。
export BASH_COMPLETION_COMPAT_DIR="$(brew --prefix)/etc/bash_completion.d" if [ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]; then source "$(brew --prefix)/etc/profile.d/bash_completion.sh" fi
参考:
git/git-completion.bash at master · git/git – GitHub
git-completion.bash を使ってブランチ名やコマンドの補完を可能にする | 極上の人生
macOS で bash-completion を有効にする (ついでに git-completion も) – Qiita
git-completion.bash 利用時にエラーが出るため、Homebrew での Git を利用するようにする – Qiita
How to Enable Git Tab Completion in Bash on Mac OS X | SpinDance
How to configure git bash command line completion? – Stack Overflow
git-prompt.sh
参考: