Gitコマンド
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-[[戻る>Git]]
--[[Gitの基本]]
--Gitコマンド
--[[インストール>Git#f825d4d1]]
*目次 [#pda27e8e]
#contents
*概要 [#za533484]
Gitコマンドの覚書
*用語 [#e37f22b0]
**repository [#u767dec9]
-ファイルやディレクトリの変更履歴を記録して管理する場所。
-管理対象のファイルやディレクトリはrepositoryの下に置く。
http://www.backlog.jp/git-guide/intro/intro1_2.html
***local / remote [#xe9dd39c]
-remote repository
--サーバに配置して複数人で共有するためのrepository。
-local repository
--ユーザ一人が利用する、自分の手元のマシン上に配置するrep...
--local repositoryの内容はremote repositoryを経由して公開...
http://www.backlog.jp/git-guide/intro/intro1_3.html
***bare / non-bare [#x017a504]
-non-bare repository~
ワーキングディレクトリを持つ。
-bare repository~
ワーキングディレクトリを持たない。更新情報だけを持ってい...
http://www.nekotricolor.com/entry/theory-of-bare-and-non-...
**branch [#m9cc16f3]
-branchとは独立な開発ラインを意味する。
-[[編集/ステージ/コミットプロセス>#o0696ae7]]に対する抽象...
http://www.backlog.jp/git-guide/stepup/stepup1_1.html
***branch名 [#g1c80a36]
- (remote)/(branch)~
remoteのrepositoryのbranch
- (origin)/(branch)~
cloneしたremoteのrepositoryのbranch
***HEAD [#fdb5fc25]
現在使用しているbranchの先頭を表す名前
***stash [#k77423b8]
ファイルの変更内容を一時的に記録しておく領域。
**commit [#hb8f3a31]
ファイルやディレクトリの追加・変更を、Repositoryに記録する
**[[編集/ステージ/コミットプロセス>Gitの基本]] [#o0696ae7]
*branch [#df55a0b8]
**branch [#tf3a027e]
branchする
-Git branch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!b...
--branch(独立な開発ライン)の作成
--作業ディレクトリやステージングエリア、プロジェクト履歴...
-command
--現在のbranchから<new-branch>をbranchする
git branch <new-branch>
**checkout [#u1308258]
branchをcheckoutする(切り替える)。
-Git checkout | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!c...
--branchを切り替える。
--HEADが移動することで、使用するbranchが変更される。
-command
--既存branch <existing-branch> に切り替える。
git checkout <existing-branch>
--新規branch <new-branch> を作成して即時checkout
git checkout -b <new-branch>
--既存branch <existing-branch>から新規branch <new-branch>...
git checkout -b <new-branch> <existing-branch>
**merge [#u18db080]
branchをmergeする。
-Git merge | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!m...
--branch(分岐した履歴)を現在のbranchへ統合する手段
-command
--指定したbranchを現在のbranchにmergeする
git merge <branch>
-- 「早送り」可能であっても、常にmerge commitを作成してme...
git merge --no-ff <branch>
-参考
--merge commitとFast-forward merge - Qiita~
http://qiita.com/shyamahira/items/59ff8aa1cf7b893aab60
**削除 [#v5c058a3]
branchを削除する。
-mergeされたbranchを削除する
git branch -d <experimental>
-mergeされたかどうかにかまわず削除する
git branch -D <experimental>
*repository [#bcd73d11]
**clone [#md913091]
git clone は既存の git repositoryのclone (コピー) を作成...
-Git clone | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!clone
--既存の Git repositoryのコピーを作成する
--コピー元repositoryをポイントする origin という名称のrem...
--svn checkout と異なり、作業コピーがそれ自身で
---完全な git repositoryを構成する。
---履歴を持ってファイルを管理する。
-command
--local or remoteのrepositoryをcloneする。
git clone <repo>
--クローン先のdirectoryを指定してcloneする。
git clone <repo> <directory>
**repository間 [#p50d4a25]
***git remote [#pd21aa82]
-Git remote | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--他のrepositoryとの接続の作成、内容確認、削除を行う
--非短縮 URL への参照として使用可能な短縮名称として機能
***git fetch [#u260b8a6]
remote repositoryからfetchする。
-Git fetch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--remote repositoryからlocal repositoryにbranchをインポー...
--local branchとしてではなく、remote branchとして保存され...
--pullと異なりlocal repositoryにmergeする前に変更内容を確...
-commit
--remoteのすべてのbranchをfetchする。
git fetch <remote>
--remoteの特定のbranchをfetchする。
git fetch <remote> <branch>
***git pull [#r6fe7f69]
remote repositoryからpull(fetch & merge)する。
-Git pull | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--git fetch commandとそれに続く git merge commandをひとつ...
-command
--現在のbranchにremote branchをfetchして即時merge
git pull <remote>
--remote branchを現在のbranchにmergeする際に git [[rebase...
git pull --rebase <remote>
***git push [#ne215224]
remote repositoryへpushする。
-Git push | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--local repositoryからremote repositoryにbranchをエクスポ...
---localな変更の中央repositoryへの公開
---remote repository内で git merge master commandを実行す...
---push先は --bare フラグを指定して作成したrepositoryに限...
-command
--指定したbranchを <remote> にpushする
git push <remote> <branch>
--すべてのlocal branchを指定したremote repositoryにpush
git push <remote> --all
--すべてのlocal tagをremote repositoryに送る
git push <remote> --tags
*ステージングの操作 [#y7ac6e3e]
**git add [#td795c21]
ステージング・エリアにaddする。
-Git add | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!add
--作業ディレクトリ内の変更をステージングエリアに追加する
--個々のファイルの変更内容を次回commitの対象とすることを ...
--git commit を実行するまでは変更がは実際に記録されない。
-command
--<file> に加えられたすべての変更をステージして次回のコミ...
git add <file>
--<directory> 内のすべての変更をステージして次回のコミッ...
git add <directory>
--インタラクティブなステージングセッションを開始する。
git add -p
**git clean [#maa79d68]
ステージング・エリアからcleanする。
-Git clean | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--作業ディレクトリから追跡対象外のファイルを削除する
--通常の rm コマンド同様 git clean コマンドも元に戻すこと...
--git reset --hardコマンドと併用される。~
reset コマンドが作用するのは追跡対象となっているファイル...
追跡対象外のファイルをクリーンアップする。
-command
--git clean の「予行演習」を行うコマンドで削除されるファ...
git clean -n
--追跡対象外のファイルをカレントディレクトリから削除する。~
ただし、.gitignore. で指定したファイルは削除しない。
git clean -f
--追跡対象外のファイルを指定したパスから削除する。
git clean -f <path>
--追跡対象外のファイルとディレクトリをカレントディレクト...
git clean -df
--追跡対象外ファイルと通常無視されるファイルをカレントデ...
git clean -xf
**git reset [#y5c171a9]
commitのreset
-Git reset | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--ステージングエリアや作業ディレクトリにおける変更を元に...
-command
--作業ディレクトリに変更も加えずに、指定したファイルをス...
git reset <file>
--作業ディレクトリに何の変更も加えることなくステージエリ...
git reset
--ステージエリアと作業ディレクトリをresetして直前のcommit...
git reset --hard
*commitの操作 [#ufb99886]
<commit> = commit の"SHA-1 id"
**git commit [#sd4b5e04]
変更のcommit
-Git commit | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!com...
--ステージされたスナップショットを取り込んでlocal reposit...
--スナップショットは常にlocal repositoryにcommitされ、他...
-command
--ステージされたスナップショットをcommit。
git commit
--commit メッセージ付きでcommit。
git commit -m "<message>"
**git revert [#j96c5e46]
commitのrevert
-Git revert | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--commitされたスナップショットを元に戻す。
--commitがなかったものとするのではなくそのcommitによって...
元に戻す方法を見出してその結果を新しいcommitとして追加す...
--履歴を保全し、履歴の完全性とコラボレーションの信頼性を...
-command
--特定のcommitのrevert
git revert <commit>
**git reset [#y5c171a9]
commitのreset
-Git reset | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--commit済みのスナップショットを削除する目的でも使用され...
--git revert コマンドは変更を元に戻す「安全な」方法
--コレに対し、git reset コマンドは変更を元に戻す「危険な...
--復元方法が無いため、ローカルな変更を元に戻す場合に限る...
-command
--現在のbranchの先端を <commit> の位置に戻した上でステー...
これにより、変更規模が小さく整理されたスナップショットを...
git reset <commit>
--現在のbranchの先端を <commit> の位置に戻した上でステー...
commit前の変更に加えて <commit> の後に行われたすべてのcom...
git reset --hard <commit>
*確認 [#ed1a8ab6]
**branch [#l771f1ea]
***git branch [#t5e56642]
branchの確認
-Git branch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!b...
--一覧表示
-command
--local branchの確認
git branch
--remote追跡branchを表示
git branch -r
--local branchとremote追跡branchの両方のbranchを表示
git branch -a
--名称の変更
git branch -m <branch>
**commit [#dde136ae]
***git log [#aa03bcf5]
logの確認
-Git log | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!log
--commit済みのスナップショットを表示するcommand
--commit済みの履歴 (commit履歴) のみが対象
---commit済み変更履歴の一覧表示
---それに対するフィルター処理
---特定の変更内容の検索
-command
--commit履歴全体をデフォルトの形式で表示
git log
--表示するcommit数を <limit> に制限する。
git log -n <limit>
--commit履歴を概観する(各々のcommitの内容を1行に圧縮して...
git log --oneline
--改変されたファイルおよびその中での追加行数と削除行数を...
git log --stat
--各々のcommitに対応するパッチ(commitの完全な差分情報)...
git log -p
**ステージング [#b46c38af]
***git status [#c4ba7161]
statusの確認
-Git status | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!sta...
--作業ディレクトリとステージングエリア(ステージされたス...
---ステージされた変更内容、
---ステージされていない変更内容
---Git による追跡の対象外となっているファイル
-command
--ステージされたファイル、されていないファイル、追跡対象...
git status
終了行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-[[戻る>Git]]
--[[Gitの基本]]
--Gitコマンド
--[[インストール>Git#f825d4d1]]
*目次 [#pda27e8e]
#contents
*概要 [#za533484]
Gitコマンドの覚書
*用語 [#e37f22b0]
**repository [#u767dec9]
-ファイルやディレクトリの変更履歴を記録して管理する場所。
-管理対象のファイルやディレクトリはrepositoryの下に置く。
http://www.backlog.jp/git-guide/intro/intro1_2.html
***local / remote [#xe9dd39c]
-remote repository
--サーバに配置して複数人で共有するためのrepository。
-local repository
--ユーザ一人が利用する、自分の手元のマシン上に配置するrep...
--local repositoryの内容はremote repositoryを経由して公開...
http://www.backlog.jp/git-guide/intro/intro1_3.html
***bare / non-bare [#x017a504]
-non-bare repository~
ワーキングディレクトリを持つ。
-bare repository~
ワーキングディレクトリを持たない。更新情報だけを持ってい...
http://www.nekotricolor.com/entry/theory-of-bare-and-non-...
**branch [#m9cc16f3]
-branchとは独立な開発ラインを意味する。
-[[編集/ステージ/コミットプロセス>#o0696ae7]]に対する抽象...
http://www.backlog.jp/git-guide/stepup/stepup1_1.html
***branch名 [#g1c80a36]
- (remote)/(branch)~
remoteのrepositoryのbranch
- (origin)/(branch)~
cloneしたremoteのrepositoryのbranch
***HEAD [#fdb5fc25]
現在使用しているbranchの先頭を表す名前
***stash [#k77423b8]
ファイルの変更内容を一時的に記録しておく領域。
**commit [#hb8f3a31]
ファイルやディレクトリの追加・変更を、Repositoryに記録する
**[[編集/ステージ/コミットプロセス>Gitの基本]] [#o0696ae7]
*branch [#df55a0b8]
**branch [#tf3a027e]
branchする
-Git branch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!b...
--branch(独立な開発ライン)の作成
--作業ディレクトリやステージングエリア、プロジェクト履歴...
-command
--現在のbranchから<new-branch>をbranchする
git branch <new-branch>
**checkout [#u1308258]
branchをcheckoutする(切り替える)。
-Git checkout | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!c...
--branchを切り替える。
--HEADが移動することで、使用するbranchが変更される。
-command
--既存branch <existing-branch> に切り替える。
git checkout <existing-branch>
--新規branch <new-branch> を作成して即時checkout
git checkout -b <new-branch>
--既存branch <existing-branch>から新規branch <new-branch>...
git checkout -b <new-branch> <existing-branch>
**merge [#u18db080]
branchをmergeする。
-Git merge | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!m...
--branch(分岐した履歴)を現在のbranchへ統合する手段
-command
--指定したbranchを現在のbranchにmergeする
git merge <branch>
-- 「早送り」可能であっても、常にmerge commitを作成してme...
git merge --no-ff <branch>
-参考
--merge commitとFast-forward merge - Qiita~
http://qiita.com/shyamahira/items/59ff8aa1cf7b893aab60
**削除 [#v5c058a3]
branchを削除する。
-mergeされたbranchを削除する
git branch -d <experimental>
-mergeされたかどうかにかまわず削除する
git branch -D <experimental>
*repository [#bcd73d11]
**clone [#md913091]
git clone は既存の git repositoryのclone (コピー) を作成...
-Git clone | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!clone
--既存の Git repositoryのコピーを作成する
--コピー元repositoryをポイントする origin という名称のrem...
--svn checkout と異なり、作業コピーがそれ自身で
---完全な git repositoryを構成する。
---履歴を持ってファイルを管理する。
-command
--local or remoteのrepositoryをcloneする。
git clone <repo>
--クローン先のdirectoryを指定してcloneする。
git clone <repo> <directory>
**repository間 [#p50d4a25]
***git remote [#pd21aa82]
-Git remote | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--他のrepositoryとの接続の作成、内容確認、削除を行う
--非短縮 URL への参照として使用可能な短縮名称として機能
***git fetch [#u260b8a6]
remote repositoryからfetchする。
-Git fetch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--remote repositoryからlocal repositoryにbranchをインポー...
--local branchとしてではなく、remote branchとして保存され...
--pullと異なりlocal repositoryにmergeする前に変更内容を確...
-commit
--remoteのすべてのbranchをfetchする。
git fetch <remote>
--remoteの特定のbranchをfetchする。
git fetch <remote> <branch>
***git pull [#r6fe7f69]
remote repositoryからpull(fetch & merge)する。
-Git pull | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--git fetch commandとそれに続く git merge commandをひとつ...
-command
--現在のbranchにremote branchをfetchして即時merge
git pull <remote>
--remote branchを現在のbranchにmergeする際に git [[rebase...
git pull --rebase <remote>
***git push [#ne215224]
remote repositoryへpushする。
-Git push | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/remote-reposito...
--local repositoryからremote repositoryにbranchをエクスポ...
---localな変更の中央repositoryへの公開
---remote repository内で git merge master commandを実行す...
---push先は --bare フラグを指定して作成したrepositoryに限...
-command
--指定したbranchを <remote> にpushする
git push <remote> <branch>
--すべてのlocal branchを指定したremote repositoryにpush
git push <remote> --all
--すべてのlocal tagをremote repositoryに送る
git push <remote> --tags
*ステージングの操作 [#y7ac6e3e]
**git add [#td795c21]
ステージング・エリアにaddする。
-Git add | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!add
--作業ディレクトリ内の変更をステージングエリアに追加する
--個々のファイルの変更内容を次回commitの対象とすることを ...
--git commit を実行するまでは変更がは実際に記録されない。
-command
--<file> に加えられたすべての変更をステージして次回のコミ...
git add <file>
--<directory> 内のすべての変更をステージして次回のコミッ...
git add <directory>
--インタラクティブなステージングセッションを開始する。
git add -p
**git clean [#maa79d68]
ステージング・エリアからcleanする。
-Git clean | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--作業ディレクトリから追跡対象外のファイルを削除する
--通常の rm コマンド同様 git clean コマンドも元に戻すこと...
--git reset --hardコマンドと併用される。~
reset コマンドが作用するのは追跡対象となっているファイル...
追跡対象外のファイルをクリーンアップする。
-command
--git clean の「予行演習」を行うコマンドで削除されるファ...
git clean -n
--追跡対象外のファイルをカレントディレクトリから削除する。~
ただし、.gitignore. で指定したファイルは削除しない。
git clean -f
--追跡対象外のファイルを指定したパスから削除する。
git clean -f <path>
--追跡対象外のファイルとディレクトリをカレントディレクト...
git clean -df
--追跡対象外ファイルと通常無視されるファイルをカレントデ...
git clean -xf
**git reset [#y5c171a9]
commitのreset
-Git reset | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--ステージングエリアや作業ディレクトリにおける変更を元に...
-command
--作業ディレクトリに変更も加えずに、指定したファイルをス...
git reset <file>
--作業ディレクトリに何の変更も加えることなくステージエリ...
git reset
--ステージエリアと作業ディレクトリをresetして直前のcommit...
git reset --hard
*commitの操作 [#ufb99886]
<commit> = commit の"SHA-1 id"
**git commit [#sd4b5e04]
変更のcommit
-Git commit | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!com...
--ステージされたスナップショットを取り込んでlocal reposit...
--スナップショットは常にlocal repositoryにcommitされ、他...
-command
--ステージされたスナップショットをcommit。
git commit
--commit メッセージ付きでcommit。
git commit -m "<message>"
**git revert [#j96c5e46]
commitのrevert
-Git revert | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--commitされたスナップショットを元に戻す。
--commitがなかったものとするのではなくそのcommitによって...
元に戻す方法を見出してその結果を新しいcommitとして追加す...
--履歴を保全し、履歴の完全性とコラボレーションの信頼性を...
-command
--特定のcommitのrevert
git revert <commit>
**git reset [#y5c171a9]
commitのreset
-Git reset | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/undoing-changes...
--commit済みのスナップショットを削除する目的でも使用され...
--git revert コマンドは変更を元に戻す「安全な」方法
--コレに対し、git reset コマンドは変更を元に戻す「危険な...
--復元方法が無いため、ローカルな変更を元に戻す場合に限る...
-command
--現在のbranchの先端を <commit> の位置に戻した上でステー...
これにより、変更規模が小さく整理されたスナップショットを...
git reset <commit>
--現在のbranchの先端を <commit> の位置に戻した上でステー...
commit前の変更に加えて <commit> の後に行われたすべてのcom...
git reset --hard <commit>
*確認 [#ed1a8ab6]
**branch [#l771f1ea]
***git branch [#t5e56642]
branchの確認
-Git branch | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-branches#!b...
--一覧表示
-command
--local branchの確認
git branch
--remote追跡branchを表示
git branch -r
--local branchとremote追跡branchの両方のbranchを表示
git branch -a
--名称の変更
git branch -m <branch>
**commit [#dde136ae]
***git log [#aa03bcf5]
logの確認
-Git log | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!log
--commit済みのスナップショットを表示するcommand
--commit済みの履歴 (commit履歴) のみが対象
---commit済み変更履歴の一覧表示
---それに対するフィルター処理
---特定の変更内容の検索
-command
--commit履歴全体をデフォルトの形式で表示
git log
--表示するcommit数を <limit> に制限する。
git log -n <limit>
--commit履歴を概観する(各々のcommitの内容を1行に圧縮して...
git log --oneline
--改変されたファイルおよびその中での追加行数と削除行数を...
git log --stat
--各々のcommitに対応するパッチ(commitの完全な差分情報)...
git log -p
**ステージング [#b46c38af]
***git status [#c4ba7161]
statusの確認
-Git status | アトラシアン Git チュートリアル~
https://www.atlassian.com/ja/git/tutorial/git-basics#!sta...
--作業ディレクトリとステージングエリア(ステージされたス...
---ステージされた変更内容、
---ステージされていない変更内容
---Git による追跡の対象外となっているファイル
-command
--ステージされたファイル、されていないファイル、追跡対象...
git status
ページ名: