forked from rogerdudler/git-guide
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
238 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
<!DOCTYPE html> | ||
<html lang="ja"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<title>git - 簡単ガイド</title> | ||
<link href='http://fonts.googleapis.com/css?family=Chelsea+Market' rel='stylesheet' type='text/css'> | ||
<link rel="stylesheet" href="css/normalize.css" type="text/css"> | ||
<link rel="stylesheet" href="css/style.css" type="text/css"> | ||
<script type="text/javascript"> | ||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-652147-13']); | ||
_gaq.push(['_trackPageview']); | ||
|
||
(function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
})(); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="scrollblock block-title"> | ||
<h1>git - 簡単ガイド</h1> | ||
<p>猫でもわかるGit 最初の一歩</p> | ||
<a href="https://twitter.com/share" class="twitter-share-button" data-via="rogerdudler" data-size="large" data-url="http://rogerdudler.github.com/git-guide" data-related="rogerdudler" data-hashtags="git">Tweet</a> | ||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
<p class="meta"> | ||
<a href="http://www.twitter.com/rogerdudler">Roger Dudler</a> (著) <a href="http://www.twitter.com/nacho4d">@nacho4d</a> (訳) | ||
<br />クレジット <a href="http://www.twitter.com/tfnico">@tfnico</a>, <a href="http://www.twitter.com/fhd">@fhd</a>, <a href="http://www.namics.com">Namics</a><br /> | ||
その他の言語 <a href="index.de.html">deutsch</a>, <a href="index.html">english</a>, <a href="index.fr.html">français</a>, <a href="index.it.html">italiano</a>, <a href="index.nl.html">nederlands</a>, <a href="index.pt_BR.html">português</a>, <a href="index.ru.html">русский</a>, <a href="index.ja.html">日本語</a><br /> | ||
問題などの報告は<a href="https://github.com/rogerdudler/git-guide/issues">github</a>でお願いします。 | ||
</p> | ||
<img src="img/arrow.png" alt="" /> | ||
</div> | ||
<!-- setup --> | ||
<a name="setup"></a> | ||
<div class="scrollblock block-setup"> | ||
<h2>設定</h2> | ||
<p> | ||
<a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3">OSX用 Gitをダウンロード</a> | ||
</p> | ||
<p> | ||
<a href="http://code.google.com/p/msysgit/downloads/list?can=3">Windows用 Gitをダウンロード</a> | ||
</p> | ||
<p> | ||
<a href="http://book.git-scm.com/2_installing_git.html">Linux用 Gitをダウンロード</a> | ||
</p> | ||
</div> | ||
<a name="create"></a> | ||
<div class="scrollblock block-create"> | ||
<h2>レポジトリの作成</h2> | ||
<p> | ||
新規のレポジトリを作成するには <br /> | ||
新しいフォルダを作って開きます。そして、<br /> | ||
<code>git init</code><br /> | ||
を実行します。 | ||
</p> | ||
</div> | ||
<a name="checkout"></a> | ||
<div class="scrollblock block-checkout"> | ||
<h2>レポジトリのチェックアウト</h2> | ||
<p> | ||
ローカルのレポジトリをクローンするには<br /> | ||
<code>git clone /path/to/repository</code><br /> | ||
そして、リモートのレポジトリをクローンするには<br /> | ||
<code>git clone username@host:/path/to/repository</code><br /> | ||
を実行します。 | ||
</p> | ||
</div> | ||
<a name="trees"></a> | ||
<div class="scrollblock block-trees"> | ||
<h2>作業の流れ</h2> | ||
<p> | ||
ローカルのレポジトリはGitが管理する三本の"木"からなっています。 | ||
第一はファイルそのものがある <code>Working Directory</code>、<br /> | ||
第二は中間的な位置にある<code>Index</code>、そして<br /> | ||
第三は最後のコミットを指す<code>HEAD</code>、 | ||
この三本です。 | ||
</p> | ||
<img src="img/trees.png" alt="" /> | ||
</div> | ||
<a name="add"></a> | ||
<div class="scrollblock block-add"> | ||
<h2>アッド & コミット</h2> | ||
<p> | ||
変更されたファイルを選択します。<br/> | ||
<code>git add <filename></code><br /> | ||
<code>git add *</code><br /> | ||
を実行すると<b>Index</b>に追加されます。<br /> | ||
これは基本的な作業の一つです。<br /> | ||
変更を実際に適用するには<br /> | ||
<code>git commit -m "Commit message"</code><br /> | ||
を実行します。<br />変更が<b>HEAD</b>に入りましたが、<br />リモートレポジトリには未だ入っていません。 | ||
</p> | ||
</div> | ||
<a name="push"></a> | ||
<div class="scrollblock block-remote"> | ||
<h2>変更のプッシュ</h2> | ||
<p> | ||
この時点で、変更がローカルレポジトリの<b>HEAD</b>に適用されました。この変更をリモートレポジトリに適用するには<br /> | ||
<code>git push origin master</code><br /> | ||
を実行し、<i>master</i>の代わりに適用のブランチ名を入れます。 | ||
<br /><br /> | ||
もし既存レポジトリをクローンせずに使用した場合<br /> | ||
<code>git remote add origin <server></code><br /> | ||
を実行すると、リモートレポジトリを登録する事が可能です。<br /> | ||
これで変更を特定なリモートレポジトリに送る(push)事ができます。<br /> | ||
</p> | ||
</div> | ||
<a name="branching"></a> | ||
<div class="scrollblock block-branching"> | ||
<h2>ブランチ</h2> | ||
<p> | ||
ブランチは関連性のない機能を実装するときに使用されるもので、レポジトリを作成する際にデフォルトのブランチは<i>master</i>です。ブランチを作って使用を終えたらメインのブランチに戻すようにしましょう。 | ||
</p> | ||
<img src="img/branches.png" alt="" /> | ||
<p> | ||
"feature_x"という名前のブランチを作って スイッチします<br /> | ||
<code>git checkout -b feature_x</code><br /> | ||
メインのブランチに戻る<br /> | ||
<code>git checkout master</code><br /> | ||
ブランチの削除<br /> | ||
<code>git branch -d feature_x</code><br /> | ||
ブランチをリモートレポジトリにプッシュしない限りブランチは他人には見れないようになっていますのでご注意ください。<br /> | ||
<code>git push origin <branch></code> | ||
</p> | ||
</div> | ||
<a name="update"></a> | ||
<div class="scrollblock block-merging"> | ||
<h2>アップデート & マージ</h2> | ||
<p> | ||
自分のレポジトリを最新のコミットにアップデートするには<br /> | ||
<code>git pull</code><br /> | ||
を作業のフォルダで実行するとリモートレポジトリの<br />最新情報を取得し(fetch)現在の状態とマージ(merge)されます。<br /> | ||
或るブランチを現在の物(master等)にマージするには次の様にします。<br /> | ||
<code>git merge <branch></code><br /> | ||
両者とも自動的にGitはマージをしようとしますが、<br />必ず成功する訳ではなく結果的に競合(conflict)が発生します。<br /> | ||
手動でファイルの編集等をする事によって<br />競合を解決しマージしなければなりません。<br /> | ||
ファイルの変更後、下記の様にマージされたとしてマークします。<br /> | ||
<code>git add <filename></code><br /> | ||
マージする前に差分を見る事もできます。<br /> | ||
<code>git diff <source_branch> <target_branch></code> | ||
</p> | ||
</div> | ||
<a name="tagging"></a> | ||
<div class="scrollblock block-tagging"> | ||
<h2>タグ</h2> | ||
<p> | ||
SVNでも使用されている概念ですが、バージョンを<br />リリースする度にタグを作る事が推奨されています。<br /> | ||
新規のタグ<i>1.0.0</i>を作成するには下記を実行します。<br /> | ||
<code>git tag 1.0.0 1b2e1d63ff</code><br /> | ||
尚、<i>1b2e1d63ff</i> はタブが指すコミットIDの10文字です。<br />コミットIDを見るにはlogを出します。<br /> | ||
<code>git log</code><br /> | ||
コミットIDは最後まで書かなくても構いませんが<br />唯一の値でなければいけません。 | ||
</p> | ||
</div> | ||
<a name="checkout-replace"></a> | ||
<div class="scrollblock block-checkout-replace"> | ||
<h2>変更の取り消し</h2> | ||
<p> | ||
うっかり間違ってしまったとき、ローカルの変更を<br />次のコマンドで取り消す事ができます。<br /> | ||
<code>git checkout -- <filename></code><br /> | ||
これはHEADの最後のコミットの状態にファイルを戻します。<br />Indexに追加された変更や新しいファイルは除きます。 | ||
</p> | ||
<p> | ||
一方、全ての変更とローカルコミットを捨てる場合、サーバーから最新情報を取得し、masterブランチがそこを指す様にする事ができます。<br /> | ||
<code>git fetch origin</code><br /> | ||
<code>git reset --hard origin/master</code> | ||
</p> | ||
</div> | ||
<a name="hints"></a> | ||
<div class="scrollblock block-hints"> | ||
<h2>便利なコマンド</h2> | ||
<p> | ||
Gitの内装GUI<br /> | ||
<code>gitk</code><br /> | ||
コンソール上でアウトプットにカラーを付加<br /> | ||
<code>git config color.ui true</code><br /> | ||
logでコミット一つに対し一行のみを表示<br /> | ||
<code>git config format.pretty oneline</code><br /> | ||
インタラクティブ方式でファイルを追加<br /> | ||
<code>git add -i</code> | ||
</p> | ||
</div> | ||
<a name="resources"></a> | ||
<div class="scrollblock block-resources"> | ||
<h2>その他のリンクと資料</h2> | ||
<h3>グラフィッククライアント</h3> | ||
<p> | ||
<ul> | ||
<li><a href="http://gitx.laullon.com/">GitX (L) (OSX, open source)</a></li> | ||
<li><a href="http://www.git-tower.com/">Tower (OSX)</a></li> | ||
<li><a href="http://www.sourcetreeapp.com/">Source Tree (OSX, free)</a></li> | ||
<li><a href="http://mac.github.com/">GitHub for Mac (OSX, free)</a></li> | ||
</ul> | ||
</p> | ||
<h3>ガイド</h3> | ||
<p> | ||
<ul> | ||
<li><a href="http://book.git-scm.com/">Git Community Book</a></li> | ||
<li><a href="http://progit.org/book/">Pro Git</a></li> | ||
<li><a href="http://progit.org/book/ja/">Pro Git(日本語)</a></li> | ||
<li><a href="http://think-like-a-git.net/">Think like a git</a></li> | ||
<li><a href="http://help.github.com/">GitHub Help</a></li> | ||
<li><a href="http://marklodato.github.com/visual-git-guide/index-en.html">A Visual Git Guide</a></li> | ||
</ul> | ||
</p> | ||
</div> | ||
<a name="comments"></a> | ||
<div class="scrollblock block-comments"> | ||
<h2>コメント</h2> | ||
<div id="disqus_thread"></div> | ||
<script type="text/javascript"> | ||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | ||
var disqus_shortname = 'git-the-simple-guide'; // required: replace example with your forum shortname | ||
|
||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
</script> | ||
<noscript><a href="http://disqus.com/?ref_noscript">コメント - powered by Disqus.</a>を見るにはJavascriptを有効にしてください。</noscript> | ||
</div> | ||
<a href="http://www.git-tower.com/?source=rd" onClick="recordOutboundLink(this, 'Outbound Links', 'git-tower.com');return false;" class="tower"></a> | ||
<a href="files/git_cheat_sheet.pdf" onClick="recordOutboundLink(this, 'Cheat Sheet', 'git-guide');return false;" class="cheatsheet"></a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.