Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

暂存区的一些思路 #19

Open
keira-hq opened this issue Jan 5, 2021 · 0 comments
Open

暂存区的一些思路 #19

keira-hq opened this issue Jan 5, 2021 · 0 comments

Comments

@keira-hq
Copy link
Collaborator

keira-hq commented Jan 5, 2021

https://img-blog.csdn.net/20160807164529000

  • 工作区(working directory)

  • 暂存区(staging area/index) git add .

    • 执行git add .命令
      • 将要提交的所有类型是文件的生成blob对象,放在objects中
      • 更新index.txt文件中的内容(首次commit,生成index.txt)
      • Index.txt中的每条索引记录的是blob对象的哈希值和其文件名
  • 仓库区(repository 本地仓库) git commit

    • 执行git commit
      • 生成index.txt中的所有索引的tree对象 Tree对象放入objects中
      • 根据最顶层的tree生成commit对象,并记录在head和对应的branch中
  • 一些操作命令示例:

    • git rm 时,把工作区中的这个文件以及暂存区中的这个文件索引都删除
    • git rm –cached 时,只把暂存区中的索引删去
    • git mv file2.txt file3.txt时,工作区中的文件被重命名(file2被重命名为file3),而索引区中的原file2的索引被删除掉了,然后重新添加了一条索引
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant