git rm (ファイル削除コマンド) の取り消し方法
「git」タグアーカイブ
[git] タグの使いかた
1. タグの作成方法
1.1. 『簡易タグ(コメントなし)』の作成方法
|
1 |
$ git tag タグ名 |
|
1 |
$ git tag v.1.10 |
- 上記のようにコミットを指定しないときは、「カレントブランチ」の「最新コミット」にタグを付与する。
[git] フォルダを移動したファイルの履歴を追跡する
背景
フォルダを移動した/リネームしたファイルの履歴が(通常操作では)途切れる。
解決策
--follow オプションを付加する
Continue listing the history of a file beyond renames (works only for a single file).
[git] 日本語ファイル名やパス名の文字化け対策
概要
Git において、日本語のファイル名やパス名が化ける。
|
1 2 3 4 5 6 7 8 9 10 |
$ git status On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) "\343\201\212\350\252\255\343\201\277\343\201\217\343\201\240\343\201\225\343\201\204.txt" nothing added to commit but untracked files present (use "git add" to track) |
[git] stash
1. git stash pop で conflict したとき
1.0 conflistの例
|
1 2 3 4 5 6 |
$ git stash pop Auto-merging inc/foo.h CONFLICT (content): Merge conflict in inc/foo.h Auto-merging src/bar.c CONFLICT (content): Merge conflict in src/bar.c The stash entry is kept in case you need it again. |
[git] Not Committed Yet
症状
git blame を実行すると Not Committed Yet が発生する。(blameが期待した通りに実行できない)
|
1 2 3 4 5 6 |
000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 1) /////////////////////////////////////////////////////////// 000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 2) // Sample.h 000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 3) // Implementation of the Class Sample 000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 4) // Created on: 2019/07/11 21:24:22 000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 5) // Original author: Jane Doe 000000000 (Not Committed Yet 2019-09-02 20:47:07 +0900 6) /////////////////////////////////////////////////////////// |
[git] ソースコード修正量計測
|
1 |
$ git diff --stat hash1 hash2 -- "*.c" "*.cpp" "*.h" |
|
1 |
$ git diff --stat hash1 hash2 -- ":(exclude)*.xlsx" |
[git] git for windows バージョンアップ
インストール済みの git for windows をバージョンアップする方法
バージョンアップ方法
Git Bash や コマンドプロンプト などから、アップデートコマンドを実行する。但し git for windows 2.1.3 以前はアップデートコマンド非対応。
|
1 |
$ git update-git-for-windows |
その後、GUIウィンドウがポップアップので指示に従ってインストールを進める。
古い git for windows (git client) への警告例
|
1 2 3 4 5 6 |
$ git fetch remote: Azure Repos remote: We noticed you're using an older version of Git. For the best experience, upgrade to a newer version. remote: Found 9 objects to send. (504 ms) Unpacking objects: 100% (9/9), done. ... |
[git] 認証情報の管理方法
|
1 |
$ git config --show-origin credential.helper |
- デフォルト : 毎回、ユーザー名とパスワードを尋ねる
- cache : メモリーキャッシュ(15分後にキャッシュから削除)
- store : ファイル(
.git-credentials)保存 - manager : 認証マネージャー
Windowsの認証マネージャ
https://github.com/microsoft/Git-Credential-Manager-for-Windows
[git] 設定一覧
基本コマンド
|
1 |
$ git config --list |
--system, --global, --local の設定が順に重複して表示される。
重複して表示された(重複して設定された)設定項目は最後に表示されたものが有効となる。