git 初步

git command help

不知道自己怎么搞的,发现了查看git命令的详细文档的一个操作

git *** --hep就可以生成对应的html文档

eg: git config --help / git commit -help

效果图如下

 

 

 

git 版本控制管理

之前并没有接触过git方面的知识,在阿里实习期间才接触到git的管理流程,当时对git一无所知,师姐耐心的手把手的教我怎么使用,惭愧惭愧,在这里首先感谢我的师姐对我的帮助,之后恶补了一堆git快速入门教程,才得以在实习中有了一些进展,这几天事情不多,正好get了一本详细的git书籍,开始系统的学习了一下git

首先我是使用的windows下的git bash进行的操作,当然感觉cygwin也是不错的选择,但是自我实践,在我的电脑上git bash命令行的反应速度超级慢(延时5s~10s),网上说是os 的io缓存造成的,还有说仓库太大,还需要把360,管家等垃圾软件退了,还有更可笑的解释是时间长了就不慢了(2333),反正解决方案试了很多,没有效果,但是cygwin的反应速度特别快。但是个人还是喜欢使用git bash,because在操作的过程中发现cygwin对命令的支持程度不及git bash (eg : ll  ls -l    )

first 我在~目录下建立了一个目录,作为初始版本库开始进行操作

mkdir ~/public_html

cd ~/public_html

touch index.html

echo "balabala..." > index.html

git init

这样便生成了隐藏文件.git

很多配置信息都存储在.git中,这个只是针对这个版本库的配置,当然也有用户级别和系统级别的config,用户级别的放在~/.gitconfig,需要通过git --global进行配置,系统级别的我暂时没有找到,因为还没有使用到,参考资料说在/etc/gitconfig or /usr/local/etc/gitconfig,感觉在ubuntu或者debian等正常的操作系统下比较正常吧,git bash和cygwin都没有sudo这回事

中途的操作都存在了下面

Administrator@USERCHI-U2H639K MINGW64 ~
$ git status -uno
fatal: Not a git repository (or any of the parent directories): .git

Administrator@USERCHI-U2H639K MINGW64 ~
$ export PATH="$HOME/bin:$PATH"

Administrator@USERCHI-U2H639K MINGW64 ~
$ ll
total 3409
lrwxrwxrwx 1 Administrator 197121      67 十月 10 15:14  「开始」菜单 -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu'/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:14  AppData/
lrwxrwxrwx 1 Administrator 197121      38 十月 10 15:14 'Application Data' -> /c/Users/Administrator/AppData/Roaming/
lrwxrwxrwx 1 Administrator 197121      64 十月 10 15:14  Cookies -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Cookies/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:33  Desktop/
drwxr-xr-x 1 Administrator 197121       0 十月 17 12:28  Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:47  Downloads/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:17  Favorites/
drwxr-xr-x 1 Administrator 197121       0 十月 26 16:19  IdeaProjects/
drwxr-xr-x 1 Administrator 197121       0 十月 29 12:13  IntelGraphicsProfiles/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Links/
lrwxrwxrwx 1 Administrator 197121      36 十月 10 15:14 'Local Settings' -> /c/Users/Administrator/AppData/Local/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Music/
lrwxrwxrwx 1 Administrator 197121      32 十月 10 15:14 'My Documents' -> /c/Users/Administrator/Documents/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  NetHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Network Shortcuts'/
-rw-r--r-- 1 Administrator 197121 2097152 十月 29 15:30  NTUSER.DAT
-rw-r--r-- 1 Administrator 197121  262144 十月 29 15:30  ntuser.dat.LOG1
-rw-r--r-- 1 Administrator 197121       0 十月 10 15:13  ntuser.dat.LOG2
-rw-r--r-- 1 Administrator 197121   65536 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms
-rw-r--r-- 1 Administrator 197121      20 十月 10 15:14  ntuser.ini
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Pictures/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  PrintHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Printer Shortcuts'/
drwxr-xr-x 1 Administrator 197121       0 十月 29 15:21  public_html/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  Recent -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Recent/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  SendTo -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/
lrwxrwxrwx 1 Administrator 197121      66 十月 10 15:14  Templates -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Templates/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Videos/
cd
Administrator@USERCHI-U2H639K MINGW64 ~
$ cd ~/p
Pictures/    PrintHood/   public_html/

Administrator@USERCHI-U2H639K MINGW64 ~
$ cd ~/public_html/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 20 十月 29 15:20 index.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git sta
git: 'sta' is not a git command. See 'git --help'.

The most similar commands are
        status
        stage
        stash

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   index.html


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "Initial contents of public_html" \
>    --author="baidu<arlenmbx@163.com>"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'Administrator@USERCHI-U2H639K.(none)')

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git config --global user.email "arlenmbx@163.com"

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git config --global user.name "mubaixu"

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "Initial contents of public_html"    --author="baixu <arlenmbx@163.com>"
[master (root-commit) d8d6af9] Initial contents of public_html
 Author: baixu <arlenmbx@163.com>
 1 file changed, 1 insertion(+)
 create mode 100644 index.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ vim
e
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ export GIT_EDITOR=vim

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "Initial contents of public_html"    --author="baixu <arlenmbx@163.com>"
On branch master
nothing to commit, working tree clean

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 20 十月 29 15:20 index.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cd .git/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ ll
total 9
-rw-r--r-- 1 Administrator 197121  32 十月 29 15:43 COMMIT_EDITMSG
-rw-r--r-- 1 Administrator 197121 130 十月 29 15:21 config
-rw-r--r-- 1 Administrator 197121  73 十月 29 15:21 description
-rw-r--r-- 1 Administrator 197121  23 十月 29 15:21 HEAD
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 hooks/
-rw-r--r-- 1 Administrator 197121 145 十月 29 15:34 index
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 info/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 logs/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 objects/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 refs/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd logs/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git/logs (GIT_DIR!)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 176 十月 29 15:36 HEAD
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 refs/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git/logs (GIT_DIR!)
$ cd ..

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ ll
total 9
-rw-r--r-- 1 Administrator 197121  32 十月 29 15:43 COMMIT_EDITMSG
-rw-r--r-- 1 Administrator 197121 130 十月 29 15:21 config
-rw-r--r-- 1 Administrator 197121  73 十月 29 15:21 description
-rw-r--r-- 1 Administrator 197121  23 十月 29 15:21 HEAD
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 hooks/
-rw-r--r-- 1 Administrator 197121 145 十月 29 15:34 index
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 info/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 logs/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 objects/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 refs/
cat
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat COMMIT_EDITMSG
Initial contents of public_html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ tmux
bash: tmux: command not found

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ sudo apt-get install tmux
bash: sudo: command not found

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ apt-get install tmux
bash: apt-get: command not found

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd /
sudo apt
Administrator@USERCHI-U2H639K MINGW64 /
$ sudo apt-get install tmux
bash: sudo: command not found

Administrator@USERCHI-U2H639K MINGW64 /
$ cd ~

Administrator@USERCHI-U2H639K MINGW64 ~
$ ll
total 3409
lrwxrwxrwx 1 Administrator 197121      67 十月 10 15:14  「开始」菜单 -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu'/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:14  AppData/
lrwxrwxrwx 1 Administrator 197121      38 十月 10 15:14 'Application Data' -> /c/Users/Administrator/AppData/Roaming/
lrwxrwxrwx 1 Administrator 197121      64 十月 10 15:14  Cookies -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Cookies/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:33  Desktop/
drwxr-xr-x 1 Administrator 197121       0 十月 17 12:28  Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:47  Downloads/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:17  Favorites/
drwxr-xr-x 1 Administrator 197121       0 十月 26 16:19  IdeaProjects/
drwxr-xr-x 1 Administrator 197121       0 十月 29 12:13  IntelGraphicsProfiles/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Links/
lrwxrwxrwx 1 Administrator 197121      36 十月 10 15:14 'Local Settings' -> /c/Users/Administrator/AppData/Local/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Music/
lrwxrwxrwx 1 Administrator 197121      32 十月 10 15:14 'My Documents' -> /c/Users/Administrator/Documents/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  NetHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Network Shortcuts'/
-rw-r--r-- 1 Administrator 197121 2097152 十月 29 15:53  NTUSER.DAT
-rw-r--r-- 1 Administrator 197121  262144 十月 29 15:53  ntuser.dat.LOG1
-rw-r--r-- 1 Administrator 197121       0 十月 10 15:13  ntuser.dat.LOG2
-rw-r--r-- 1 Administrator 197121   65536 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms
-rw-r--r-- 1 Administrator 197121      20 十月 10 15:14  ntuser.ini
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Pictures/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  PrintHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Printer Shortcuts'/
drwxr-xr-x 1 Administrator 197121       0 十月 29 15:21  public_html/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  Recent -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Recent/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  SendTo -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/
lrwxrwxrwx 1 Administrator 197121      66 十月 10 15:14  Templates -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Templates/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Videos/

Administrator@USERCHI-U2H639K MINGW64 ~
$ cd p
bash: cd: p: No such file or directory
cd pu
Administrator@USERCHI-U2H639K MINGW64 ~
$ cd public_html/
ll

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 20 十月 29 15:20 index.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cd .git/
ll

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ ll
total 9
-rw-r--r-- 1 Administrator 197121  32 十月 29 15:43 COMMIT_EDITMSG
-rw-r--r-- 1 Administrator 197121 130 十月 29 15:21 config
-rw-r--r-- 1 Administrator 197121  73 十月 29 15:21 description
-rw-r--r-- 1 Administrator 197121  23 十月 29 15:21 HEAD
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 hooks/
-rw-r--r-- 1 Administrator 197121 145 十月 29 15:34 index
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 info/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 logs/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 objects/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 refs/
cat c
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
git
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd ..

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 20 十月 29 15:20 index.html
vim
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ gedit index.html
bash: gedit: command not found

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ vim index.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cat index.html
<html>
        <body>
my website is alive!
</body>
</html>


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit index.html
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory.
[master 8e924a2] Convert to HTML
 1 file changed, 6 insertions(+), 1 deletion(-)

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git log
commit 8e924a2e7275b853ec5f66d128ff2c0933af90b7 (HEAD -> master)
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:59:06 2017 +0800

    Convert to HTML

commit d8d6af907c50e2f546456d16be603a97da997ea4
Author: baixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:36:01 2017 +0800

    Initial contents of public_html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git show 8e924a2e7275b853ec5f66d128ff2c0933af90b7
commit 8e924a2e7275b853ec5f66d128ff2c0933af90b7 (HEAD -> master)
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:59:06 2017 +0800

    Convert to HTML

diff --git a/index.html b/index.html
index 8865c96..c9cff2d 100644
--- a/index.html
+++ b/index.html
@@ -1 +1,6 @@
-my website is alive
+<html>
+       <body>
+my website is alive!
+</body>
+</html>
+

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git diff 8e924a2e7275b853ec5f66d128ff2c0933af90b7 d8d6af907c50e2f546456d16be603a97da997ea4
diff --git a/index.html b/index.html
index c9cff2d..8865c96 100644
--- a/index.html
+++ b/index.html
@@ -1,6 +1 @@
-<html>
-       <body>
-my website is alive!
-</body>
-</html>
-
+my website is alive

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git diff 8e924a2e7275b853ec5f66d128ff2c0933af90b7 d8d6af907c50e2f546456d16be603a97da^C


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ touch poem.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 53 十月 29 15:57 index.html
-rw-r--r-- 1 Administrator 197121  0 十月 29 16:17 poem.html
vim
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ vim poem.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cat poem.html
fuck     shit

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git add poem.html poem.html
warning: LF will be replaced by CRLF in poem.html.
The file will have its original line endings in your working directory.

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git add poem.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   poem.html


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "add a remove file "  --author="mubaixu <arlenmbx@163.com>"
[master c742a65] add a remove file
 1 file changed, 1 insertion(+)
 create mode 100644 poem.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git log
commit c742a65cf1e9e181719e5ae18307075ca3a10a5a (HEAD -> master)
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 16:19:45 2017 +0800

    add a remove file

commit 8e924a2e7275b853ec5f66d128ff2c0933af90b7
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:59:06 2017 +0800

    Convert to HTML

commit d8d6af907c50e2f546456d16be603a97da997ea4
Author: baixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:36:01 2017 +0800

    Initial contents of public_html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git rm poem.html
rm 'poem.html'

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    poem.html


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "remove the poem.html" --author="baixu <arlenmbx@163.com>"
[master e0c3a10] remove the poem.html
 Author: baixu <arlenmbx@163.com>
 1 file changed, 1 deletion(-)
 delete mode 100644 poem.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git mv index.html index_1.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        renamed:    index.html -> index_1.html


Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git commit -m "Rename index.html to index_1.html" --author="baixu <arlenmbx@163.com>"
[master 58de85d] Rename index.html to index_1.html
 Author: baixu <arlenmbx@163.com>
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename index.html => index_1.html (100%)

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cd ~

Administrator@USERCHI-U2H639K MINGW64 ~
$ git clone public_html my_website
Cloning into 'my_website'...
done.

Administrator@USERCHI-U2H639K MINGW64 ~
$ ll
total 3413
lrwxrwxrwx 1 Administrator 197121      67 十月 10 15:14  「开始」菜单 -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu'/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:14  AppData/
lrwxrwxrwx 1 Administrator 197121      38 十月 10 15:14 'Application Data' -> /c/Users/Administrator/AppData/Roaming/
lrwxrwxrwx 1 Administrator 197121      64 十月 10 15:14  Cookies -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Cookies/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:33  Desktop/
drwxr-xr-x 1 Administrator 197121       0 十月 17 12:28  Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:47  Downloads/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:17  Favorites/
drwxr-xr-x 1 Administrator 197121       0 十月 26 16:19  IdeaProjects/
drwxr-xr-x 1 Administrator 197121       0 十月 29 12:13  IntelGraphicsProfiles/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Links/
lrwxrwxrwx 1 Administrator 197121      36 十月 10 15:14 'Local Settings' -> /c/Users/Administrator/AppData/Local/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Music/
lrwxrwxrwx 1 Administrator 197121      32 十月 10 15:14 'My Documents' -> /c/Users/Administrator/Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 16:30  my_website/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  NetHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Network Shortcuts'/
-rw-r--r-- 1 Administrator 197121 2097152 十月 29 16:27  NTUSER.DAT
-rw-r--r-- 1 Administrator 197121  262144 十月 29 16:27  ntuser.dat.LOG1
-rw-r--r-- 1 Administrator 197121       0 十月 10 15:13  ntuser.dat.LOG2
-rw-r--r-- 1 Administrator 197121   65536 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms
-rw-r--r-- 1 Administrator 197121      20 十月 10 15:14  ntuser.ini
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Pictures/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  PrintHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Printer Shortcuts'/
drwxr-xr-x 1 Administrator 197121       0 十月 29 16:25  public_html/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  Recent -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Recent/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  SendTo -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/
lrwxrwxrwx 1 Administrator 197121      66 十月 10 15:14  Templates -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Templates/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Videos/

Administrator@USERCHI-U2H639K MINGW64 ~
$ ls -lsa public_html my_website
my_website:
total 13
0 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:30 ./
8 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:30 ../
4 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:30 .git/
1 -rw-r--r-- 1 Administrator 197121 59 十月 29 16:30 index_1.html

public_html:
total 17
4 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:25 ./
8 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:30 ../
4 drwxr-xr-x 1 Administrator 197121  0 十月 29 16:26 .git/
1 -rw-r--r-- 1 Administrator 197121 53 十月 29 15:57 index_1.html

Administrator@USERCHI-U2H639K MINGW64 ~
$ diff -r public_html my_website
Only in public_html/.git: COMMIT_EDITMSG
diff -r public_html/.git/config my_website/.git/config
7a8,13
> [remote "origin"]
>       url = C:/Users/Administrator/public_html
>       fetch = +refs/heads/*:refs/remotes/origin/*
> [branch "master"]
>       remote = origin
>       merge = refs/heads/master
Binary files public_html/.git/index and my_website/.git/index differ
diff -r public_html/.git/logs/HEAD my_website/.git/logs/HEAD
1,5c1
< 0000000000000000000000000000000000000000 d8d6af907c50e2f546456d16be603a97da997ea4 mubaixu <arlenmbx@163.com> 1509262561 +0800 commit (initial): Initial contents of public_html
< d8d6af907c50e2f546456d16be603a97da997ea4 8e924a2e7275b853ec5f66d128ff2c0933af90b7 mubaixu <arlenmbx@163.com> 1509263946 +0800 commit: Convert to HTML
< 8e924a2e7275b853ec5f66d128ff2c0933af90b7 c742a65cf1e9e181719e5ae18307075ca3a10a5a mubaixu <arlenmbx@163.com> 1509265185 +0800 commit: add a remove file
< c742a65cf1e9e181719e5ae18307075ca3a10a5a e0c3a100562f000856dbaa3c7b60e2fcedc81f0a mubaixu <arlenmbx@163.com> 1509265424 +0800 commit: remove the poem.html
< e0c3a100562f000856dbaa3c7b60e2fcedc81f0a 58de85d3dd141fbed0dff15a73b85de8ec7ec455 mubaixu <arlenmbx@163.com> 1509265597 +0800 commit: Rename index.html to index_1.html
---
> 0000000000000000000000000000000000000000 58de85d3dd141fbed0dff15a73b85de8ec7ec455 mubaixu <arlenmbx@163.com> 1509265847 +0800 clone: from C:/Users/Administrator/public_html
diff -r public_html/.git/logs/refs/heads/master my_website/.git/logs/refs/heads/master
1,5c1
< 0000000000000000000000000000000000000000 d8d6af907c50e2f546456d16be603a97da997ea4 mubaixu <arlenmbx@163.com> 1509262561 +0800 commit (initial): Initial contents of public_html
< d8d6af907c50e2f546456d16be603a97da997ea4 8e924a2e7275b853ec5f66d128ff2c0933af90b7 mubaixu <arlenmbx@163.com> 1509263946 +0800 commit: Convert to HTML
< 8e924a2e7275b853ec5f66d128ff2c0933af90b7 c742a65cf1e9e181719e5ae18307075ca3a10a5a mubaixu <arlenmbx@163.com> 1509265185 +0800 commit: add a remove file
< c742a65cf1e9e181719e5ae18307075ca3a10a5a e0c3a100562f000856dbaa3c7b60e2fcedc81f0a mubaixu <arlenmbx@163.com> 1509265424 +0800 commit: remove the poem.html
< e0c3a100562f000856dbaa3c7b60e2fcedc81f0a 58de85d3dd141fbed0dff15a73b85de8ec7ec455 mubaixu <arlenmbx@163.com> 1509265597 +0800 commit: Rename index.html to index_1.html
---
> 0000000000000000000000000000000000000000 58de85d3dd141fbed0dff15a73b85de8ec7ec455 mubaixu <arlenmbx@163.com> 1509265847 +0800 clone: from C:/Users/Administrator/public_html
Only in my_website/.git/logs/refs: remotes
Only in my_website/.git: packed-refs
Only in my_website/.git/refs: remotes
diff -r public_html/index_1.html my_website/index_1.html
1,6c1,6
< <html>
<       <body>
< my website is alive!
< </body>
< </html>
<
---
> <html>
>       <body>
> my website is alive!
> </body>
> </html>
>

Administrator@USERCHI-U2H639K MINGW64 ~
$ cd public_html/

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ cd .git/
ll

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ ll
total 13
-rw-r--r-- 1 Administrator 197121  34 十月 29 16:26 COMMIT_EDITMSG
-rw-r--r-- 1 Administrator 197121 130 十月 29 15:21 config
-rw-r--r-- 1 Administrator 197121  73 十月 29 15:21 description
-rw-r--r-- 1 Administrator 197121  23 十月 29 15:21 HEAD
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 hooks/
-rw-r--r-- 1 Administrator 197121 145 十月 29 16:26 index
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 info/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:36 logs/
drwxr-xr-x 1 Administrator 197121   0 十月 29 16:26 objects/
drwxr-xr-x 1 Administrator 197121   0 十月 29 15:21 refs/
cat
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd ~/.gitconfig
bash: cd: /c/Users/Administrator/.gitconfig: Not a directory
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat ~/.gitconfig
[user]
        email = arlenmbx@163.com
        name = mubaixu

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat /etc/gitconfig
cat: /etc/gitconfig: No such file or directory

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cat /etc/.gitconfig
cat: /etc/.gitconfig: No such file or directory

Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd /usr/local/
bash: cd: /usr/local/: No such file or directory
c
Administrator@USERCHI-U2H639K MINGW64 ~/public_html/.git (GIT_DIR!)
$ cd /usr/
ll

Administrator@USERCHI-U2H639K MINGW64 /usr
$ ll
total 132
drwxr-xr-x 1 Administrator 197121 0 十月 29 14:31 bin/
drwxr-xr-x 1 Administrator 197121 0 十月 29 14:31 lib/
drwxr-xr-x 1 Administrator 197121 0 十月 29 14:31 libexec/
drwxr-xr-x 1 Administrator 197121 0 十月 29 14:31 share/
drwxr-xr-x 1 Administrator 197121 0 十月 29 14:31 ssl/

Administrator@USERCHI-U2H639K MINGW64 /usr
$ cd /etc/

Administrator@USERCHI-U2H639K MINGW64 /etc
$ ll
total 97
-rw-r--r-- 1 Administrator 197121   622 八月 31 12:22 bash.bash_logout
-rw-r--r-- 1 Administrator 197121  2339 八月 31 12:22 bash.bashrc
-rw-r--r-- 1 Administrator 197121  4196 八月 31 12:22 DIR_COLORS
-rw-r--r-- 1 Administrator 197121  1744 八月 31 12:22 docx2txt.config
-rw-r--r-- 1 Administrator 197121   271 八月 31 12:22 fstab
-rw-r--r-- 1 Administrator 197121  2627 十月 17 21:17 inputrc
-rw-r--r-- 1 Administrator 197121   218 十月 29 14:31 install-options.txt
-rw-r--r-- 1 Administrator 197121  1826 八月 31 12:22 msystem
lrwxrwxrwx 1 Administrator 197121    12 十月 29 14:31 mtab -> /proc/mounts
-rw-r--r-- 1 Administrator 197121   407 六月 11  2009 networks
-rw-r--r-- 1 Administrator 197121   211 八月 31 12:22 nsswitch.conf
-rw-r--r-- 1 Administrator 197121  3137 十月 23 22:02 package-versions.txt
drwxr-xr-x 1 Administrator 197121     0 十月 29 14:31 pkcs11/
drwxr-xr-x 1 Administrator 197121     0 十月 29 14:31 pki/
-rw-r--r-- 1 Administrator 197121  6578 八月 31 12:22 profile
drwxr-xr-x 1 Administrator 197121     0 十月 29 14:31 profile.d/
-rw-r--r-- 1 Administrator 197121  1358 六月 11  2009 protocols
-rw-r--r-- 1 Administrator 197121 17463 六月 11  2009 services
drwxr-xr-x 1 Administrator 197121     0 十月 29 14:31 ssh/
-rw-r--r-- 1 Administrator 197121 16596 十月  4 07:09 tigrc
-rw-r--r-- 1 Administrator 197121  2285 十月 17 21:17 vimrc

Administrator@USERCHI-U2H639K MINGW64 /etc
$ git config -l
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email=arlenmbx@163.com
user.name=mubaixu

Administrator@USERCHI-U2H639K MINGW64 /etc
$ cat ~/public_html/.git/config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true

Administrator@USERCHI-U2H639K MINGW64 /etc
$ git config --help

Administrator@USERCHI-U2H639K MINGW64 /etc
$ git config --global alias.show-graph 'commit -m "this is a simple commit ^C


cd ~

Administrator@USERCHI-U2H639K MINGW64 /etc
$ cd ~

Administrator@USERCHI-U2H639K MINGW64 ~
$ ll
total 3413
lrwxrwxrwx 1 Administrator 197121      67 十月 10 15:14  「开始」菜单 -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu'/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:14  AppData/
lrwxrwxrwx 1 Administrator 197121      38 十月 10 15:14 'Application Data' -> /c/Users/Administrator/AppData/Roaming/
lrwxrwxrwx 1 Administrator 197121      64 十月 10 15:14  Cookies -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Cookies/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:33  Desktop/
drwxr-xr-x 1 Administrator 197121       0 十月 17 12:28  Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 14:47  Downloads/
drwxr-xr-x 1 Administrator 197121       0 十月 10 15:17  Favorites/
drwxr-xr-x 1 Administrator 197121       0 十月 26 16:19  IdeaProjects/
drwxr-xr-x 1 Administrator 197121       0 十月 29 12:13  IntelGraphicsProfiles/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Links/
lrwxrwxrwx 1 Administrator 197121      36 十月 10 15:14 'Local Settings' -> /c/Users/Administrator/AppData/Local/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Music/
lrwxrwxrwx 1 Administrator 197121      32 十月 10 15:14 'My Documents' -> /c/Users/Administrator/Documents/
drwxr-xr-x 1 Administrator 197121       0 十月 29 16:30  my_website/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  NetHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Network Shortcuts'/
-rw-r--r-- 1 Administrator 197121 2097152 十月 29 16:56  NTUSER.DAT
-rw-r--r-- 1 Administrator 197121  262144 十月 29 16:56  ntuser.dat.LOG1
-rw-r--r-- 1 Administrator 197121       0 十月 10 15:13  ntuser.dat.LOG2
-rw-r--r-- 1 Administrator 197121   65536 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
-rw-r--r-- 1 Administrator 197121  524288 十月 10 15:15  NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms
-rw-r--r-- 1 Administrator 197121      20 十月 10 15:14  ntuser.ini
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Pictures/
lrwxrwxrwx 1 Administrator 197121      74 十月 10 15:14  PrintHood -> '/c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Printer Shortcuts'/
drwxr-xr-x 1 Administrator 197121       0 十月 29 16:25  public_html/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  Recent -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Recent/
lrwxrwxrwx 1 Administrator 197121      63 十月 10 15:14  SendTo -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/
lrwxrwxrwx 1 Administrator 197121      66 十月 10 15:14  Templates -> /c/Users/Administrator/AppData/Roaming/Microsoft/Windows/Templates/
drwxr-xr-x 1 Administrator 197121       0 七月 14  2009  Videos/
cd pub
Administrator@USERCHI-U2H639K MINGW64 ~
$ cd public_html/
ll

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
gittotal 1
-rw-r--r-- 1 Administrator 197121 53 十月 29 15:57 index_1.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git config --global alias.show-graph 'commit -m "this is a simpe commit !" --author="test <arlenmbx@163.com>"'

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ l
bash: l: command not found
ll

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ ll
total 1
-rw-r--r-- 1 Administrator 197121 53 十月 29 15:57 index_1.html
touch
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ touch test.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ vim test.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git add test.html
git warning: LF will be replaced by CRLF in test.html.
The file will have its original line endings in your working directory.
stat
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.html

git
Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git show-graph
[master 3cdbfbd] this is a simpe commit !
 Author: test <arlenmbx@163.com>
 1 file changed, 2 insertions(+)
 create mode 100644 test.html

Administrator@USERCHI-U2H639K MINGW64 ~/public_html (master)
$ git log
commit 3cdbfbd6ed20942a4ba0c64aec274397ca5e74f2 (HEAD -> master)
Author: test <arlenmbx@163.com>
Date:   Sun Oct 29 17:03:16 2017 +0800

    this is a simpe commit !

commit 58de85d3dd141fbed0dff15a73b85de8ec7ec455
Author: baixu <arlenmbx@163.com>
Date:   Sun Oct 29 16:26:37 2017 +0800

    Rename index.html to index_1.html

commit e0c3a100562f000856dbaa3c7b60e2fcedc81f0a
Author: baixu <arlenmbx@163.com>
Date:   Sun Oct 29 16:23:44 2017 +0800

    remove the poem.html

commit c742a65cf1e9e181719e5ae18307075ca3a10a5a
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 16:19:45 2017 +0800

    add a remove file

commit 8e924a2e7275b853ec5f66d128ff2c0933af90b7
Author: mubaixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:59:06 2017 +0800

    Convert to HTML

commit d8d6af907c50e2f546456d16be603a97da997ea4
Author: baixu <arlenmbx@163.com>
Date:   Sun Oct 29 15:36:01 2017 +0800

    Initial contents of public_html
View Code

(1)个人感觉最后一个配置别名的操作很棒,简化了很多流程

(2)git mv 其实可以通过mv -> git rm ->git add实现

(3)git config 不加global可以针对当前版本库进行配置,覆盖用户级别的config

(4)clone后的差别可以通过ls -lsa查看,或者通过diff -r递归的逐个文件的查看

(5)git log   有针对性的可以使用 git show ID /  git show-branch --more=count

 ------其他的都是比较基础的固定性命令了

posted @ 2017-10-29 17:27  柳下_MBX  阅读(708)  评论(0编辑  收藏  举报