What is a git “Snapshot”?

后端 未结 8 582
孤城傲影
孤城傲影 2020-12-04 12:01

The official Git doc says:

$ git diff test

This will show you what is different between your current working directory and the snapsh

8条回答
  •  有刺的猬
    2020-12-04 12:20

    The term snapshot is used in the git reference site as well

    It is the replacement term for "Revision". In other version control systems, changes to individual files are tracked and refered to as revisions, but with git you are tracking the entire workspace, so they use the term snapshot to denote the difference.

    From http://gitref.org/index.html

    Instead of writing a tool that versions each file individually, like Subversion, we would probably write one that makes it easier to store snapshots of our project without having to copy the whole directory each time.

    This is essentially what Git is. You tell Git you want to save a snapshot of your project with the git commit command and it basically records a manifest of what all of the files in your project look like at that point. Then most of the commands work with those manifests to see how they differ or pull content out of them, etc.

    If you think about Git as a tool for storing and comparing and merging snapshots of your project, it may be easier to understand what is going on and how to do things properly.

提交回复
热议问题