1、Getting Started
介紹 git 跟其它版本控制軟體的不同,及其起源、如何安裝、如何建立環境…等。



1.1 - About Version Control
Version Control 分成三種:
  • Local Version Control Systems
  • Centralized Version Control Systems
  • Distributed Version Control Systems

  • 其中 Local Version Control Systems 及 Centralized Version Control Systems 都有如果 server 端發生問題的話,則會造成整個 system 無法恢復的情況。
    而 Distributed Version Control Systems 中,每個 client 都擁有完整的檔案系統,所以就算 server 端發生問題,也很容易復原原本的檔案系統,當然 git 就是屬於一種系統。



    1.2 - A Short History of Git
    Git 是由 Linux development community 根據其之前的使用經驗而研發出來的軟體。



    1.3 - Git Basics
    Git 儲存的是整個檔案系統的 snapshot,而不是與前一版本的 difference。
    也因為幾乎整個檔案系統都存在於本機上,所以幾乎所有的功能操作都可以在本機端完成,在沒有網路的情況下,就是 git 可以好好發揮的地方。 。

    在 git 中,每個檔案都可能處於以下三種狀態的其中一種:
  • committed
  • modified
  • staged

  • Committed means that the data is safely stored in your local database.
    Modified means that you have changed the file but have not committed it to your database yet.
    Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

    也因為所有的檔案可以分類為這三種狀態,所以可以將 git 檔案系統分成三個區域:
  • the Git directory
  • the working directory
  • the staging area


  • The Git directory is where Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer.

    The working directory is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify.

    The staging area is a simple file, generally contained in your Git directory, that stores information about what will go into your next commit.

    基本的 git 檔案流程可以歸納為:
  • 在 working directory 中修改檔案
  • stage 這些檔案,在 staging area 中增加這些檔案的 snapshot
  • 作完 commit 後,便會將這些在 staging area 的檔案,永久地寫入 git directory




  • 1.4 - Installing Git
    yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
    yum install git-core




    1.5 - First-Time Git Setup
    git config --global user.name "Abc Def"
    git config --global user.email abcdef@example.com



    1.6 - Getting Help
    $ git help 'verb'
    $ git 'verb' --help
    $ man git-'verb'




    1.7 - Summary
    You should have a basic understanding of what Git is and how it’s different from the CVCS you may have been using.
    You should also now have a working version of Git on your system that’s set up with your personal identity.

    arrow
    arrow
      全站熱搜
      創作者介紹

      silverfoxkkk 發表在 痞客邦 留言(0) 人氣()