gitの使い方(通常ルーチン)

gitにて管理しているものを変更してブランチに反映する場合は、

  • git statusやgit diffで変更内容を確認
  • git add で変更したものを追加
  • git commit でローカルにコミット
  • git push でリモートにプッシュ

という流れ。

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   README.md
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/README.md b/README.md
index 301f77c..0aa390d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ ticked the li elements of your documents.

 This is the jquery plugin that displays li elements like news ticker.

-If you want to set the easing option name to the option, you require
+If you want to set the easing option name to the 'easing' option, you require
 including jQuery Easing plugin (http://gsgd.co.uk/sandbox/jquery/easing/).

 for example
$ git add README.md
$ git commit -m 'modified README.md'
[master 803ecf4] modified README.md
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git push origin master
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 329 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@github.com:kohchi/jquery-listticker.git
   104efc6..803ecf4  master -> master
$

以下、参考サイト。

http://memememomo.hatenablog.com/entry/20100421/1271806163
http://npnl.hatenablog.jp/entry/20101107/1289121576
http://kray.jp/blog/review-git-commands/