Gitについて、基本的な使い方
2023年12月12日
git fetch --prune
https://zenn.dev/hankei6km/articles/git-rebase-onto
https://akizora.tech/git-rebase-3684
git commit --amend
git commit --amend -m "an updated commit message"
https://www.atlassian.com/ja/git/tutorials/rewriting-history
https://qiita.com/take4s5i/items/15d8648405f4e7ea3039
https://qiita.com/kawasaki_dev/items/41afaafe477b877b5b73
[alias]
graph = log --graph --date=short --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%x09%s %C(red)%d%Creset\"
oneline = log --oneline --no-merges --date=short --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%x09%s %C(red)%d%Creset\"
| オプション | 説明 |
|---|---|
| -p | 各コミットのdiffを表示する |
| --word-diff | 単語単位でdiffを表示する |
| --stat | 各コミットで変更されたファイルの統計情報を表示する |
| --shortstat | --stat コマンドのうち、変更/追加/削除 の行だけを表示する |
| --name-only | コミット情報の後に変更されたファイルの一覧を表示する |
| --name-status | 変更されたファイルと 追加/修正/削除 情報を表示する |
| --abbrev-commit | ハッシュの全体 (40文字) ではなく最初の数文字のみを表示する |
| --relative-date | 完全な日付フォーマットではなく、相対フォーマット (“2 weeks ago” など) で日付を表示する |
| --pretty | コミットを別のフォーマットで表示する。オプションとして oneline, short, full, fuller そして format (独自フォーマットを設定する) を指定可能 |
| --oneline | --pretty=oneline --abbrev-commitと同じ意味の便利なオプション |
| --graph | ブランチやマージの歴史を、ログ出力とともにアスキーグラフで表示する |
| --no-merges | マージコミットを表示しない |
| --author='kamem' | 指定したユーザーのコミットのみ表示する |
git remote prune origin
git grep '検索文字列'
git grep '検索文字列' <ブランチ名>
git grep -e 'パターン1' --and -e 'パターン2'
git grep '検索文字列' -- *.md
git grep -n '検索文字列'
git update-index --skip-worktree <path>
git ls-files -v | grep ^S
git update-index --no-skip-worktree <path>
https://blog.foresta.me/posts/git_useful_command_collection/