What is a git “Snapshot”?

后端 未结 8 584
孤城傲影
孤城傲影 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:41

    Based on the other definitions posted:

    A snapshot is a representation of the current state of your tracked files in the form of a manifest, which can be compared with other manifests to see where the differences are.

    Git only tracks the differences between manifests from the first moment it was tracked. If a file has not been changed since the very first snapshot, all subsequent snapshots will refer to the very first snapshot. If the file has been changed, all subsequent snapshots will refer to the snapshot that has the most recent changes. What git stores is effectively a chained history of snapshots from the last to the very first. A branch is basically a split in the timeline, allowing for an alternate historical chain of snapshots from a specific snapshot on the main chain.

    Branches are usually intended for features and such that may at some point be merged into the main branch. If there's no intention merge, but rather a divergence from the original project in the form of a new and entirely separate copy of the project with its own history, it's often called a hard fork, referring to "a fork in the road".

    0 讨论(0)
  • 2020-12-04 12:42

    Following are some of the contexts in which the term snapshot is used:

    1. A new commit is created by taking a snapshot of the Index.
    2. A commit is a snapshot of the repo at a given time.
    0 讨论(0)
提交回复
热议问题