カレントディレクトリを作業ツリーにする。 具体的には .gitディレクトリが生成される。 まったく何もない状態から始めるならここから。
mkdir testrepo
cd testrepo
git init
git clone https://foo/path/to/path.git ./workrepo
git clone --depth 1 <URL>
git fsck [-full]
git gc
git status
git diff
コマンド名は "add" だけどファイルを変更した際も "add" コマンドを実行する
git add path [path ... ]
-a オプションをつけると addコマンドなしに
変更したファイルを自動的にコミット
-m オプションを付けないと登録したエディタが
自動的に開いてメッセージ編集
git commit [-a] [-m "commit message"]
コミットしたけど変更が足りなかったとか スペルミスが見つかったとかでちょっとしたミス を修正するだけなので履歴を作りたくないって 場合に直前のコミットにまとめる
git commit --amend
git tag タグ名
git log
UNDOみたいな感じ
git reset
resetと違ってログは残る
git revert
push = fetch + merge
git pull 取り込むリポジトリ
マージはしない
git fetch 取り込むリポジトリ
リモートにマージさせる
git push 送信先リポジトリ 送信元ブランチ:送信先ブランチ
git push -u origin master
git stash [save ["message"]]
git stash pop [stash@{1}]
git apply [stash@{1}]
git stash show [stash@{1}]
git branch
git branch ブランチ名
git checkout ブランチ名
git branch ブランチ名
git checkout ブランチ名
or
git checkout -b ブランチ名
あたかも分岐先ブランチが無かったかのように
git merge マージするブランチ名
git merge --no-ff マージするブランチ名
(svn の update みたいな感じだろうか) 派生元ブランチ->派生ブランチの順番
git rebase 派生元ブランチ名
git branch -d ブランチ名
git show-branch
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
mkdir common.git
cd common.git
git init --bare