内容へ移動
メモとかメモのようなものとか(By ルーキーの中のひと)
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
ODT 出力
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
development: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 オプションは、指定したコミットを含むブランチのみを表示 ===== 標準出力に出力 ===== git --no-pager <command> ===== log ===== * %%--%%oneline: 1commit 1行のみログ表示 * %%--%%decorate: branch名、tag名などの別名を表示 * %%--%%graph: revision graphを表示 * %%--%%branches: 他のbranchのlogも表示 * %%--%%tags: tagを表示 * %%--%%remotes: remote branchなどを表示 ==== merge commitを表示しない ==== git log --no-merges ==== 指定ブランチ間のlogを表示 ==== git --no-pager log <ブランチA>..<ブランチB> ===== 最新の履歴だけを取得 ===== git clone --depth 1 https://github.com/git/git ===== shortlog ===== shortlog コマンドは git log の特別なバージョンで、リリースを作成することを目的としています。\\ 作成者別にコミットメッセージの最初の行を表示します。 ===== 特定のフォルダのみpull ===== 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> ===== ユーザ名・パスワードの設定 ===== <file config ~/.netrc> machine github.com login username password xxxxxxx </file> または、git cloneするURLに埋め込む((user,passに@が含まれているとエラーになるのでちうい。記号はエンコードしませう))((.git/config のURLにuser、passがまんま埋め込まれるので要注意)) git clone https://user:pass@github.com/pathto/repos.git ===== 参考 ===== * [[https://qiita.com/2m1tsu3/items/6d49374230afab251337|基本的なGitコマンドまとめ]] * [[https://qiita.com/ponsuke0531/items/1e0ab0d6845ec93a0dc0|Gitの一部のディレクトリだけ取得する方法]]
development/git.txt
· 最終更新: 2022/08/14 22:23 by
hayashi
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
ODT 出力
文書の先頭へ