hub-killer / git-notes

learning how to use git
0 stars 0 forks source link

How does Git recognize you changes? #2

Open bitfishxyz opened 5 years ago

bitfishxyz commented 5 years ago

Git can only recognize your changes of plain text files but not binary files.

  1. Asuming there is an text file me.md in your folder.

    Hi, my name is Jack.
    I am learning git.

    There are origin files and git will give it an ID(asuming it is aaaa).

  2. If you change it to this:

    Hi, my name is Jack.
    I am learning git.
    How are you ?
    • Git will notice that you add a line to the file's third line.
    • With your actions(will talk it later), git will store a record to .git folder.
    • Then git will return an ID (asuming it is bbbb) to you and you can back up to any timepoint any time.
  3. Then you change you file to this,

    Hi, my name is Bob.
    I am learning git.
    How are you ?

    you just change one word, but git is not so smart. It will think you delete the first line and add a new line to it's header.Asuming is ID is cccc

  4. of course, you can add new file 'navy.png'

GIt will save those records, so that you can back up anytimes!

bitfishxyz commented 5 years ago

this is a diagram:

screen shot 2018-12-28 at 8 43 38 am