What is GIT Staging and Difference between Add To Index and Add To GIT Index?

Deadly 提交于 2021-02-07 20:59:37

问题


I am using GibHub private repository. I don't have enough knowledge about it.
What is Git Staging ? what is the purpose of Git Staging ?
When to use Git Staging ?
I found two different options to add file in Git Staging.

  1. Project Explorer --> Team --> Add to index
  2. Team Synchronize --> Add to Git Index

Both of them send files to Git Staging. Then What is the difference between these two ? Which is better to user ? Both of them send files to Git Staging.

Thanks.


回答1:


They do the same thing. It's just an inconsistency in the labeling.

I pushed a change for EGit to make this consistent, it will be in the next release (3.5).




回答2:


"Staging" is the process that one performs when selecting which modified files (or portion of files) will be part of the next commit.

The "Index" is the file into which Git stores the files that have been staged. It's also called the "Staging area".

Adding a file to the index is merely saying "Git, this version of this file in my working directory should be part of the next commit I'm about to create".

References:

  • Egit - User guide
  • ProGit - Recording changes to the repository


来源:https://stackoverflow.com/questions/24677225/what-is-git-staging-and-difference-between-add-to-index-and-add-to-git-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!