gitの使い方
ローカルでの作業
レポジトリの作成
$ git init
ファイルの追加
$ git add .
ファイルのコミット
$ git commit -am "Comment"
ファイルの削除
$ git rm ファイル名
ファイルのインデックスから削除
$ git rm --cached ファイル名
ブランチの作成
$ git branch ブランチ名
$ git checkout -b ブランチ名
ブランチの移動
$git checkout ブランチ名
ブランチのマージ
$ git merge マージするブランチ
変更されたファイルの表示
$ git status
コミットのログを表示する
$ git log
リモートレポジトリ
ベアレポジトリの作成
$ git init --bare
ローカルでの作業
サーバの登録
$ git remote add origin gitサーバー:パス
ファイルのプッシュ(ブランチを作成した場合はブランチもpushする必要あり)
$ git push origin master
クローン作成
$ git clone gitサーバー:パス フォルダ名
最新版の取得
git pull
普段の使い方
- レポジトリの作成(git init)p
- ファイルの追加(git add .)
- ファイルのコミット(git commit)
- 変更がうまく行ったらマージ(git merge)
- サーバにプッシュ(git push)