ローカルブランチの一覧を表示
-r、もしくは、–remotes
リモートブランチの一覧を表示
-a、もしくは–all
リモートブランチを含んだブランチの一覧を表示
HEADにマージ済みのブランチの一覧を表示
HEADにマージされていないブランチの一覧
指定したbranchnameで、新しいブランチを作成
新しく作成したブランチへの切り替えを行う場合は、git checkout <branchname>
新しいブランチの作成と切り替えを同時に行う場合は、git checkout -b <branchname>
-d、もしくは、–delete
指定したブランチを削除
-rを付けた場合は、リモートブランチを削除
指定したブランチの内容が、追跡しているリモートブランチ(設定されていない場合はHEAD)にマージされていないと削除できない
マージの状態に関わらず、指定したブランチを削除
-m、もしくは、–move
現在チェックアウトしているブランチ名を<new branchname>に変更
git branch -m <old branchname> <new branchname>で変更元を指定することも可能
現在のブランチ名を表示
contains オプションは、指定したコミットを含むブランチのみを表示
git --no-pager <command>
git log --no-merges
git --no-pager log <ブランチA>..<ブランチB>
git clone --depth 1 https://github.com/git/git
shortlog コマンドは git log の特別なバージョンで、リリースを作成することを目的としています。
作成者別にコミットメッセージの最初の行を表示します。
git init git config core.sparsecheckout true git remote add origin リポジトリのURL<https://exsample.com/git/repoitory> echo I_want/this/folder/ > .git/info/sparse-checkout git pull origin master
# git clone --mirror User@oldrepos.example.com:/path/to/Project.git # git remote set-url --push origin User@newrepos.example.net:/path/to/Project.git # git push --mirror
$ git clone --mirror <SOURCE_REPOSITORY_URL> $ cd <REPOSITORY> ⇐ ⇑のコマンドで作成される ~.gitのフォルダ $ git push --mirror <DESTINATION_REPOSITORY_URL>
machine github.com login username password xxxxxxx
.git/configに書く
[remote "origin"] url = https://{user}:{トークン}@github.com/pathto/repos.git
git clone https://user:pass@github.com/pathto/repos.git
passを埋め込まない
git clone https://{user}:{トークン}@github.com/pathto/repos.git