工作區:您的項目目錄;又名工作號碼簿
索引:Git記錄的項目您已從工作區編輯add
;又名臨時區域
本地資源庫:存儲在項目的.git
目錄提交和分支的集合
遠程倉庫:另一個倉庫爲同一個項目是outwith項目目錄。 (不一定是不同的計算機上,但幾乎總是)
爲了證明:
$ cd my-dev-work
$ mkdir fooproject
$ cd fooproject // your workspace
$ git init // creates local repo and index, with default branch 'master'
$ echo "hello world!" >> foo.txt
$ git add foo.txt // foo.txt added to the index
$ git commit -m "Created foo.txt" // foo.txt added to local repo in a new commit
$ git remote add origin https://github.com/joebloggs/foo.git
// adds a link to a remote repository, in this case on Github, named 'origin'
$ git push origin master
// push your local'master' branch to the 'origin' remote repo,
// including the new commit containing 'foo.txt'
半局部 - 這是我最喜歡的Git講座之一:https://www.youtube.com/watch ?v = duqBHik7nRo –