git命令来创建根目录
MM@MM-pc:~$ cd Desktop/myworkspace/
MM@MM-pc:~/Desktop/myworkspace$ mkdir demo
MM@MM-pc:~/Desktop/myworkspace$ cd demo
MM@MM-pc:~/Desktop/myworkspace/demo$ git init (生成git根目录)
Initialized empty Git repository in /home/MM/Desktop/myworkspace/demo/.git/
MM@MM-pc:~/Desktop/myworkspace/demo$ ls -aF(查看git)
./ ../ .git/
MM@MM-pc:~/Desktop/myworkspace/demo$ echo "Hello." > welcome.txt
MM@MM-pc:~/Desktop/myworkspace/demo$ git add welcome.txt
MM@MM-pc:~/Desktop/myworkspace/demo$ git commit -m "initialized."
[master (root-commit) 8455f49] initialized.
1 file changed, 1 insertion(+)
create mode 100644 welcome.txt
MM@MM-pc:~/Desktop/myworkspace/demo$ git grep "H"
welcome.txt:Hello.
MM@MM-pc:~/Desktop/myworkspace/demo$ strace -e 'trace=file' git status(使用strace 命令去跟踪执行git status 命令时的磁盘访问,会看拿到目录依次向上递归的过程)
MM@MM-pc:~/Desktop/myworkspace/demo$ git rev-parse --git-dir(显示版本库.git 目录所在的位置)
.git
MM@MM-pc:~/Desktop/myworkspace/demo$ git rev-parse --show-toplevel(显示工作区根目录)
/home/MM/Desktop/myworkspace/demo
MM@MM-pc:~/Desktop/myworkspace/demo$ git rev-parse --show-prefix(相对于工作区根目录的相对目录)
MM@MM-pc:~/Desktop/myworkspace/demo$ git log --pretty=fuller(查看谁提交的记录)
commit 2e963679e7a026d0a50414072ec0e14d8fac3d1b
Author: a_b <a_b@aa.com>
AuthorDate: Fri Aug 23 16:03:23 2013 +0800
Commit: a_b <a_b@aa.com>
CommitDate: Fri Aug 23 16:03:23 2013 +0800
who does commit
commit 8455f493bb7e7cfdf92f0e86e2e04442a6ecc6ba
Author: a_b <a_b@aa.com>
AuthorDate: Fri Aug 23 15:11:19 2013 +0800
Commit: a_b <a_b@aa.com>
CommitDate: Fri Aug 23 15:11:19 2013 +0800
initialized.
MM@MM-pc:~/Desktop/myworkspace/demo$ echo "Nice to meet u." >> welcome.txt (在welcome.ext尾部追加“Nice ...”字串)