software:git:git-basic-commands
差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| software:git:git-basic-commands [2019/10/18 01:17] – yoko | software:git:git-basic-commands [2020/06/01 06:29] (現在) – [参考] yoko | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| Gitでよく使うコマンド | Gitでよく使うコマンド | ||
| =================== | =================== | ||
| - | よく使うGitコマンドの備忘録。 | + | 通常は[[software: |
| - | clone | + | Gitリポジトリの取得 |
| - | ----- | + | ------------------ |
| - | リポジトリ取得については、「[[software/ | + | cloneについては、「[[software/ |
| - | リモートブランチの取得 | ||
| - | -------------------- | ||
| - | ### リモートにどんなブランチがあるか調べる | + | よく使うGitコマンド |
| + | ------------------ | ||
| + | |||
| + | ### リモートブランチの取得 | ||
| + | |||
| + | #### リモートにどんなブランチがあるか調べる | ||
| <code bash> | <code bash> | ||
| 行 38: | 行 41: | ||
| `git checkout -b other_branch` | `git checkout -b other_branch` | ||
| - | 現在の状況確認 | + | ### 現在の状況確認 |
| - | ------------- | + | |
| いまのブランチや、前回のコミットと比較してどのファイルが変更されたの状況表示。 | いまのブランチや、前回のコミットと比較してどのファイルが変更されたの状況表示。 | ||
| 行 50: | 行 52: | ||
| </ | </ | ||
| + | ### ブランチを切り替える | ||
| + | #### ブランチを変更 | ||
| + | <code bash> | ||
| + | $ git checkout develop | ||
| + | Switched to branch ' | ||
| + | Your branch is up to date with ' | ||
| + | </ | ||
| + | |||
| + | ### インデックス(ステージ)に追加 | ||
| + | |||
| + | #### ファイルやディレクトリをインデックスに登録 | ||
| + | |||
| + | <code bash> | ||
| + | $ git add [filename] | ||
| + | </ | ||
| + | |||
| + | #### すべての変更がある内容をインデックスに追加 | ||
| + | |||
| + | <code bash> | ||
| + | $ git add -A | ||
| + | </ | ||
| + | |||
| + | ### コミット | ||
| + | |||
| + | #### インデックスに追加されたファイルをコミット | ||
| + | |||
| + | <code bash> | ||
| + | $ git commit | ||
| + | </ | ||
| + | |||
| + | #### コミットメッセージを同時に指定 | ||
| + | |||
| + | <code bash> | ||
| + | $ git commit -m " | ||
| + | </ | ||
| + | |||
| + | #### 変更されたファイルをインデックスに追加しコミット | ||
| + | |||
| + | <code bash> | ||
| + | $ git commit -a | ||
| + | </ | ||
| + | |||
| + | * 但し、新規追加されたものは含まれないので、必要があれば `add` で事前に追加。 | ||
| + | |||
| + | ###push | ||
| + | |||
| + | #### リモートリポジトリに書き込む | ||
| + | |||
| + | <code bash> | ||
| + | $ git push [remote repository PATH] [branch] | ||
| + | </ | ||
| + | |||
| + | * 引数を省略すると、今のブランチを書き込む。 | ||
| + | |||
| + | ### pull | ||
| + | |||
| + | #### リモートリポジトリの変更の取り込み | ||
| + | |||
| + | <code bash> | ||
| + | $ git pull [remote repository PATH] [branch] | ||
| + | </ | ||
| + | |||
| + | * 引数を省略すると、今のブランチを読み込む。 | ||
| + | |||
| + | ### remote | ||
| + | |||
| + | #### リモートリポジトリの一覧表示 | ||
| + | |||
| + | <code bash> | ||
| + | $ git remote | ||
| + | </ | ||
| + | |||
| + | ### fetch | ||
| + | |||
| + | #### リモートリポジトリの最新情報を取得 | ||
| + | |||
| + | <code bash> | ||
| + | $ git fetch | ||
| + | </ | ||
| 参考 | 参考 | ||
| 行 58: | 行 139: | ||
| 1. [[https:// | 1. [[https:// | ||
| 2. [[https:// | 2. [[https:// | ||
| + | |||
| + | - - - | ||
| + | |||
software/git/git-basic-commands.1571361428.txt.gz · 最終更新: by yoko
