- 初期設定
$ git config --global user.email "you@example.com"↵
$ git config --global user.name "Your Name"↵
- ローカル リポジトリを作成
$ cd ~/work↵
$ git init↵
Initialized empty Git repository in /home/username/work/.git/
- ファイルの作成
$ echo "# test" >> README.md↵
- 状態の確認
$ git status↵
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
README.md
nothing added to commit but untracked files present (use "git add" to track)
- ローカル リポジトリのインデックスにファイルを追加
$ git add README.md↵
- 状態の確認
$ git status↵
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md
- ローカル リポジトリにファイルをコミット
$ git commit -m "first commit"↵
[master (root-commit) a2b604f] first commit
1 file changed, 1 insertion(+)
create mode 100644 README.md
- 状態の確認
$ git status↵
On branch master
nothing to commit, working tree clean
- ログの確認
$ git log↵
commit a2b604f408a6a0f24a0951e93baa2ec310e21f0e (HEAD -> master)
Author: Your Name <you@example.com>
Date: Mon Nov 26 16:35:39 2018 +0900
first commit