Git
目次
概要
公式サイト
関連サイト
インストール
# Ubuntu
apt install git
# mac brew
brew install git
設定
設定ファイルの位置
以下等を読み込む 基本的には「.config」以下を利用した方が良い
- ${HOME}/.config/git/config
- ${HOME}/.gitconfig
コマンドで設定編集
git config で設定書き込みができる
$ git config --global user.name 'your name'
$ git config --global user.email you@example.com
上記のようにすると、configに以下のように書き込まれる
[user]
name = your name
email = you@example.com
設定確認
現状反映されている設定を確認するには以下のようにする
git config --global --list
利用方法
git tag
タグ一覧
git tag
タグ詳細
git show タグ名
現在の場所にタグ付与
git tag -a タグ名 -m 'タグコメント'
後から付与する場合
git tag -a タグ名 -m 'タグコメント' コミット名やbranch名
タグのpush
git push origin タグ名
submodule
追加
git submodule add https:...(等)
削除
追加したsubmoduleを削除する場合
git submodule deinit -f <submodule>
git rm -f <submodule>
rm -rf .git/modules/<submodule>
コマンド追加
git はコマンドを追加可能
gitflow
- gitflow:本家git flow は2012年9月移行メンテされていない
- github-flow
- gitflow-avh:git flow フォーク版
- GitHub - SakuraCredit/gitflow: HubFlow: A Git extension to make it easy to use GitFlow with GitHub. Based on the original gitflow extension for git.
プラグイン
クライアントツール
CUI
Mac/Windows
Mac、windows両方で挙動するツールを利用するのが良いと思う
- Tower : 有料ツールだが、かなり高機能。仕事で利用するならこれが良いと思う
- Sourcetree: 無料で利用できる。基本的な機能は網羅している
Emacs
自分はgit関連操作をほぼ全てmagitで実施してしまっている
