グローバル設定
$git config --global user.name "Peichao Yu"
$git config --global user.email "hoge@gmail.com"
現在の設定を見る
$git config -l
特定設定項目を削除
$git config --unset --global user.email
レポジトリを作る
$mkdir ~/public_html
$cd ~/public_html
$echo ."this is my website" > index.html
$git init
エディター環境を設定
//in tcsh
$setenv GIT_EDITOR emacs
//in bash
$export GIT_EDITOR=vim
コミット操作
$git commit -m "message"
ファイル追加
$git add index.html
$git add . #ディレクトリ内のサブディレクトリやファイルを全て追加
$git commit -m "ファイルを追加しましたよー"
変更が加えられたファイルを表示
$ git status
// On branch master
// Changed but not updated:
// (use "git add ..." to update what will be committed)
//
// modified: SomeModifiedFile.h
// modified: SomeModifiedFile.m
//
no changes added to commit (use "git add" and/or "git commit -a")
特定コミットの詳細をみる
$git show 5934tgds8g90w3wgseuv8945
$git show-branch --more=10 #現在ブランチの要約を表示
コミット間の区別をみる
$git diff 23truwer0gy3490hg0 489ty89hv34vh348g
ファイル削除
$git rm FileToDelete.html
$git commit -m "Deleted FileToDelete.html"
ファイル改名
$git mv Source.html Target.html
$git commit -m "Moved Source.html to Target.html"