ユーザ用ツール

サイト用ツール


development:git

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
development:git [2020/07/07 16:41]
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> ====
 +
 +指定したbranchnameで、新しいブランチを作成\\
 +新しく作成したブランチへの切り替えを行う場合は、git checkout <branchname> \\
 +新しいブランチの作成と切り替えを同時に行う場合は、git checkout -b <branchname> 
 +
 +==== git branch -d <branchname> ====
 +
 +-d、もしくは、--delete\\
 +指定したブランチを削除\\
 +-rを付けた場合は、リモートブランチを削除\\
 +指定したブランチの内容が、追跡しているリモートブランチ(設定されていない場合はHEAD)にマージされていないと削除できない
 +
 +==== git branch -D <branchname> ====
 +
 +
 +マージの状態に関わらず、指定したブランチを削除
 +
 +==== git branch -m <new branchname> ====
 +
 +-m、もしくは、--move\\
 +
 +現在チェックアウトしているブランチ名を<new branchname>に変更\\
 +git branch -m <old branchname> <new branchname>で変更元を指定することも可能
 +
 +==== git branch --contains ====
 +現在のブランチ名を表示
 +
 +contains オプションは、指定したコミットを含むブランチのみを表示
 +
  
 ===== 標準出力に出力 ===== ===== 標準出力に出力 =====
行 48: 行 101:
   # git push --mirror   # git push --mirror
  
 +  $ git clone --mirror <SOURCE_REPOSITORY_URL>
 +  $ cd <REPOSITORY> ⇐ ⇑のコマンドで作成される ~.gitのフォルダ
 +  $ git push --mirror <DESTINATION_REPOSITORY_URL>
 ===== ユーザ名・パスワードの設定 ===== ===== ユーザ名・パスワードの設定 =====
  
行 55: 行 111:
 password xxxxxxx password xxxxxxx
 </file> </file>
 +
 +または、git cloneするURLに埋め込む((user,passに@が含まれているとエラーになるのでちうい。記号はエンコードしませう))((.git/config のURLにuser、passがまんま埋め込まれるので要注意))
 +
 +  git clone https://user:pass@github.com/pathto/repos.git
 +
  
 ===== 参考 ===== ===== 参考 =====
development/git.1594107660.txt.gz · 最終更新: 2020/07/07 16:41 by hayashi