このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
development:git [2019/01/23 14:19] hayashi |
development:git [2022/08/14 22:23] (現在) hayashi [リポジトリの引越し] |
||
---|---|---|---|
行 1: | 行 1: | ||
====== git ====== | ====== git ====== | ||
+ | |||
+ | ===== branchコマンド ===== | ||
+ | ==== git branch ==== | ||
+ | ローカルブランチの一覧を表示 | ||
+ | ==== git branch -r ==== | ||
+ | |||
+ | |||
+ | -r、もしくは、--remotes\\ | ||
+ | リモートブランチの一覧を表示 | ||
+ | ==== git branch -a ==== | ||
+ | -a、もしくは--all\\ | ||
+ | リモートブランチを含んだブランチの一覧を表示 | ||
+ | |||
+ | ==== git branch --merged ==== | ||
+ | |||
+ | |||
+ | HEADにマージ済みのブランチの一覧を表示 | ||
+ | |||
+ | ==== git branch --no-merged ==== | ||
+ | |||
+ | |||
+ | HEADにマージされていないブランチの一覧 | ||
+ | |||
+ | ==== git branch < | ||
+ | |||
+ | 指定したbranchnameで、新しいブランチを作成\\ | ||
+ | 新しく作成したブランチへの切り替えを行う場合は、git checkout < | ||
+ | 新しいブランチの作成と切り替えを同時に行う場合は、git checkout -b < | ||
+ | |||
+ | ==== git branch -d < | ||
+ | |||
+ | -d、もしくは、--delete\\ | ||
+ | 指定したブランチを削除\\ | ||
+ | -rを付けた場合は、リモートブランチを削除\\ | ||
+ | 指定したブランチの内容が、追跡しているリモートブランチ(設定されていない場合はHEAD)にマージされていないと削除できない | ||
+ | |||
+ | ==== git branch -D < | ||
+ | |||
+ | |||
+ | マージの状態に関わらず、指定したブランチを削除 | ||
+ | |||
+ | ==== git branch -m <new branchname> | ||
+ | |||
+ | -m、もしくは、--move\\ | ||
+ | |||
+ | 現在チェックアウトしているブランチ名を< | ||
+ | git branch -m <old branchname> | ||
+ | |||
+ | ==== git branch --contains ==== | ||
+ | 現在のブランチ名を表示 | ||
+ | |||
+ | contains オプションは、指定したコミットを含むブランチのみを表示 | ||
+ | |||
===== 標準出力に出力 ===== | ===== 標準出力に出力 ===== | ||
行 7: | 行 60: | ||
===== log ===== | ===== log ===== | ||
- | * --oneline: 1commit 1行のみログ表示 | + | * %%--%%oneline: 1commit 1行のみログ表示 |
- | * --decorate: branch名、tag名などの別名を表示 | + | * %%--%%decorate: branch名、tag名などの別名を表示 |
- | * --graph: revision graphを表示 | + | * %%--%%graph: revision graphを表示 |
- | * --branches: 他のbranchのlogも表示 | + | * %%--%%branches: 他のbranchのlogも表示 |
- | * --tags: tagを表示 | + | * %%--%%tags: tagを表示 |
- | * --remotes: remote branchなどを表示 | + | * %%--%%remotes: remote branchなどを表示 |
行 28: | 行 81: | ||
git clone --depth 1 https:// | git clone --depth 1 https:// | ||
+ | |||
+ | ===== shortlog ===== | ||
+ | |||
+ | shortlog コマンドは git log の特別なバージョンで、リリースを作成することを目的としています。\\ | ||
+ | 作成者別にコミットメッセージの最初の行を表示します。 | ||
===== 特定のフォルダのみpull ===== | ===== 特定のフォルダのみpull ===== | ||
行 42: | 行 100: | ||
# git remote set-url --push origin User@newrepos.example.net:/ | # git remote set-url --push origin User@newrepos.example.net:/ | ||
# git push --mirror | # git push --mirror | ||
+ | |||
+ | $ git clone --mirror < | ||
+ | $ cd < | ||
+ | $ git push --mirror < | ||
+ | ===== ユーザ名・パスワードの設定 ===== | ||
+ | |||
+ | <file config ~/ | ||
+ | machine github.com | ||
+ | login username | ||
+ | password xxxxxxx | ||
+ | </ | ||
+ | |||
+ | または、git cloneするURLに埋め込む((user, | ||
+ | |||
+ | git clone https:// | ||
+ | |||
===== 参考 ===== | ===== 参考 ===== | ||
- | [[https:// | + | * [[https:// |
+ | * [[https:// |