目次
$ git config --global core.editor "vim"
$ git config --global user.name "testtest"
$ git config --global user.email "32xxxx33+xxxx@users.noreply.github.com"
<- ダミーのメール。githubのWebサイトで確認(GitHubサイトで、アイコン表示のために一致させる必要がある)
$ git config --list |grep -E "user|editor"
git clone https://example.com/ユーザ名/プロジェクト名.git cd プロジェクト名
tig ← repo ディレクトリで tig 立ち上げて s で status みて u で stage に追加して C で commit して 1行目にコミットメッセージを書いて:wq P で push して (要設定)
Fetchの場合
F で Fetch する (要設定) #リモートレポジトリ(origin)からデータを取ってくる M で Mergeする
Pullの場合
L で pull する (要設定) #ローカルレポジトリをリモートレポジトリ(origin)と同期させる
mkdir test1 cd test1/ git init echo aaa > test.txt git add test.txt git commit -m "first commit"
echo 2222 >> test.txt tig ← repo ディレクトリで tig 立ち上げて s で status みて u で stage に追加して C で commit して
:!git remote add origin git@githubcom:<Account>/test1.git #リモートの追加 :!git push -u origin master #リモート(origin)のmasterにpush
| 動作 | 操作 | 備考 |
|---|---|---|
| tigを起動 | $ tig #チェックアウトしているブランチのみを表示 $ tig --all #全てのブランチを表示 | ビジュアライズされたgit logが表示される |
| tigを終了 | Q | Close all views and quit |
| ヘルプ画面 | h | Show help view |
| 画面の更新 | RかF5 | Reload and refresh view |
| 動作 | 操作 | 備考 |
|---|---|---|
| 画面を終了。前の画面に戻る | q | Close the current view |
| status画面を表示 | sかS(shift+s) | ビジュアライズされた git statusShow status view |
| main画面を表示 tigのmain view | m | Show main view |
| log画面の表示 | l (小文字のエル) | |
| branch一覧(refs)を表示 (refs=references) | r | Show refs view 以前は、H(shift+h)だった。 |
| tree-viewの表示 ファイラーのような感じ | t | tree-viewで、「eキー」でエディター起動 |
#「h」でのヘルプの内容
View switching
m view-main Show main view
d view-diff Show diff view
l view-log Show log view
t view-tree Show tree view
f view-blob Show blob view
b view-blame Show blame view
r view-refs Show refs view
s, S view-status Show status view
c view-stage Show stage view
y view-stash Show stash view
g view-grep Show grep view
p view-pager Show pager view
h view-help Show help view
| 動作 | 操作 | 備考 |
|---|---|---|
| 画面の半分で差分確認 | エンター | ビジュアライズされた差分の詳細 |
| 全画面で差分の詳細 | d | Show diff view ビジュアライズされた差分の詳細 |
#「h」でのヘルプの内容
[-] main bindings
Option toggling:
G :toggle commit-title-graph
F :toggle commit-title-refs
External commands:
C ?git cherry-pick %(commit)
| 動作 | 操作 | 備考 |
|---|---|---|
| ファイルの差分表示 | エンター | |
| ファイル編集 | 差分にカーソルがある状態で、「e」 | |
| ファイルのステータス変更 | ファイルを選択した状態で、u | |
| commit | C(shift+c) | git commitと同じくエディターが立ち上がります 1行目にコミットメッセージを書いて:wq |
| originへpush | P(shift+p) | .tgircに設定が必要 下記参照 |
#「h」でのヘルプの内容
[-] status bindings
View-specific actions
u status-update Stage/unstage chunk or file changes
! status-revert Revert chunk or file changes
M status-merge Merge file using external tool
External commands:
C !git commit
#.tigrcの設定内容 bind generic P ?git push -u %(remote) %(repo:head)
ファイルを選択した状態で、uで、ステータスの状態を変更しますが、ステータスの意味は以下になります。
| Changes to be committed | git add したもの |
| Changed but not updated | 変更があったファイル |
| Untracked files | 新しく作成されたファイル |
refs=references
| 動作 | 操作 | 備考 |
|---|---|---|
| カーソルのあるBranchをCheckout | C(Shift+c) | |
| カーソルのあるBranchを削除 | ! | YかNか聞かれる |
| 今のブランチにカーソルのあるブランチをmerge | M(shift+m) | .tgircに設定が必要 下記参照 |
#「h」でのヘルプの内容
[-] refs bindings
External commands:
C ?git checkout %(branch)
! ?git branch -D %(branch)
#.tigrcの設定内容 bind refs M ?git merge %(branch)
標準では登録されていない操作は、:キーから入力すると行えます。
| プッシュ | :!git push origin :!git push -u origin master | リモートのoriginへプッシュ |
| フェッチ | :!git fetch | リモート(origin)からデータを取ってくるだけ。 この時点ではローカルのmainブランチには反映されていません. |
| プル | !git pull origin main | originからmainへ更新 |
| ブランチを作成 | :!git checkout -b <作成するブランチ名> | |
| マージ | :!git merge new-branch | mainにマージしたい場合、 mainに移動してから、 マージしたいブランチ名を入力する |
| 直前の コミットメッセージ 修正 | :!git commit --amend -m "メッセージ" | |
| 直前のcommitを取り消し | :!git reset --hard HEAD^ | |
| 今の状態を取り消し、 commitIDの状態にする | git reset --hard COMMITID |
# マウスを有効にする set mouse = true # 検索時に大文字小文字を無視する (default: false) set ignore-case = true # リフレッシュするタイミング set refresh-mode = auto #set refresh-mode = after-command #set refresh-mode = periodic #set refresh-interval = 1
# set key 'P' bind generic P ?git push -u %(remote) %(repo:head) # set key 'U' bind generic U ?git pull %(remote) # set key 'F' bind generic F ?git fetch %(remote) bind main F ?git fetch %(remote) # Branch Operation bind refs M ?git merge %(branch) bind refs P ?git push origin %(branch) bind refs L ?git pull origin %(branch) ##### Move ##### # set key 'g' / goto file top bind generic g move-first-line # set key 'G' / goto file bottom bind generic G move-last-line bind main G move-last-line # set key 'E' bind generic E view-grep
https://github.com/jonas/tig/issues/199
Ctrl + x で、閉じる。 $ git config --global core.editor "vim"
tigでは、一度もコミットしていない場合利用できません。
まずはコマンドでコミットしましょう。git commit -m "first"
]$ tig tig: No revisions match the given arguments. ]$
tigで、commit時い以下のエラーがでて、うまくcommitできない問題がありました。
hint: Waiting for your editor to close the file... Vim: 警告: 端末への出力ではありません Vim: 警告: 端末からの入力ではありません
core.editorの設定しましょう。
$ which vim /usr/bin/vim $ git config --global core.editor "/usr/bin/vim" $ cat ~/.gitconfig (略) editor = P:/win-soft/free/cmder/cmder/vendor/git-for-windows/usr/bin/vim (略)
一般向けサイト
ITエンジニア向けサイト
英語サイト
Portfolio
Copyright (c) 2025 インフラエンジニアのPC環境 All Rights Reserved.