Git

初期設定

  • 以下がお勧めの初期設定

# 必須設定
git config --global core.autocrlf false
git config --global core.ignorecase false
git config --global color.ui true
git config --global core.quotepath false
git config --global core.filemode false

# 必要に応じて設定
git config --global user.name 'Your Name'
git config --global user.email 'example@example.com'
git config --global credential.helper 'cache --timeout=86400'
  • 有効にしたはずなのにならない場合は、localと競合している可能性がある。

  • 少なくとも以下は競合していたので、実行が必要かも。

git config --local --unset core.ignorecase
git config --local --unset core.filemode

設定確認

  • 設定値を編集する場合

  • 設定値を削除するには、--unsetを使う。

Gitのバージョンアップ

  • Linuxの場合

  • Windows(Git for Windows)の場合

Git for Windowsのターミナルをタスクバーから起動した際にhomeから始める方法

  • ショートカットのリンク先に以下のようなオプションをつける。

Windowsで複数のgitアカウントを使い分ける。

  • Git for Windowsは必要。credential.namespaceを使えばできる。

  • オプション付きでcloneする。

  • repositoryに移動し、gitのlocal configでnamespaceを設定する。

  • 参考

    • https://qiita.com/shiena/items/fc7783a82d59be5ff259

Gitの内部構造

  • たぶんもう怖くないGit Git内部の仕組み

    • https://qiita.com/marchin_1989/items/2ec01553e907f3a9e6bb

Gitの複数アカウントの扱い(SSH keyを使う)

  • SSH keyを生成

    • 参考 https://hana-shin.hatenablog.com/entry/2021/12/21/202454

  • .pubファイルをGitHubに登録

  • clone済みの場合はリモートレポジトリをいったん削除

  • ~/.ssh/configに以下を記載

  • 接続テスト

  • リモートレポジトリを追加

  • 参考

    • https://t-salad.com/multiple-git-account/

mergeとrebaseの違い

ブランチ一覧取得

ローカル

リモート

さらに日付順。

git rebase

git rebase -> force-with-leaseの流れが良いらしい?

Windowsでシンボリックリンクを使う

Last updated