Also known as staging area, this is where Git keeps changes made to versioned files and what it uses when it creates a new node in history graph (when you do a commit). This is also the reason why git add is so important, as it adds changes to staging area.
Questions tagged [git-index]
89 questions
1
vote
1 answer
diff does not contain new files
I am working on a project which uses git. Whenever I make changes, I submit a patch to the main developer who apply and commit it. Things worked nicely this far whith:
git diff > somepatch.patch
But when I create new files, The above command…

LightSith
- 795
- 12
- 27
1
vote
1 answer
understanding git reset effect on index
I'm having a small conflict when reading documentations/tutorials about git reset: For git reset --mixed for example, the documentation says:
The next thing reset will do is to update the Index with the contents of whatever snapshot HEAD now points…

Zizou
- 831
- 1
- 10
- 19
1
vote
1 answer
Add a file to a Github repo that will be cloned, but not tracked
I feel like this question must have been asked before, but I'm not finding it on here. I have a file that I want in a GitHub repo, in this case a file in which the user would paste their API keys after cloning. I want this blank file to be cloned…

jwong1219
- 11
- 1
1
vote
1 answer
Bad index file while in shared directory
I use an Ubuntu VM over Windows 8 using VMWare and while using git I got an error of
error: bad index file sha1 signature
fatal: index file corrupt
When trying to commit.
Now, I found ways to fix this (the primary one, deleting .git/index and…

Neo
- 3,534
- 2
- 20
- 32
1
vote
2 answers
Why isn't it sufficient to just stage work-in-progress before switching branches? Why must I also commit?
I'm working on some files in one branch (called big_new_feature). The files are not ready to commit, but I need to switch branches to make a quick fix in another branch (called stable_branch). Why can't I just stage the files in big_new_feature and…

osullic
- 543
- 1
- 8
- 21
1
vote
0 answers
How does staging a file modify the index file internally?
git index(.git/index) stores the state of tracked files (last committed state) and it can be shown via git ls-files --stage and git diff looks at the difference between index and working directory. How does the use of git add to stage files modify…

Boon
- 40,656
- 60
- 209
- 315
1
vote
3 answers
Can you stage a file (or at least, a section of a file) DURING a git diff?
Before I stage files, I like to perform a git diff to check that everything is okay. While I'm vertically traversing down a diff, I make a mental note of each file that is "OK" for staging. If it's a particularly long diff, I find it hard to keep…

XåpplI'-I0llwlg'I -
- 21,649
- 28
- 102
- 151
0
votes
1 answer
For a given Git repository, how do I find the path to its index file?
Suppose that I am running a script inside a Git repository and want to access the index file directly. How can I get the path to the index file, in a way that also respects e.g. worktrees?

Waleed Khan
- 11,426
- 6
- 39
- 70
0
votes
0 answers
Restore git index to it's previous state after mistakenly invoking git read-tree
While resolving merge conflicts I accidently executed git read-tree which broke my index. As I'm still on porcelain level I'm not sure what happened and if it's restorable. Can I get back to my resolved conflicts from before and continue merging…

qesterius
- 1
- 1
0
votes
0 answers
git error: read error while indexing: Invalid argument
I'm initializing a repo in a Google Drive folder which contains a gsheet file. When I index the folder this error happens:
git add .
error: read error while indexing file.gsheet: Invalid argument
error: file.gsheet: failed to insert into…

Ooker
- 1,969
- 4
- 28
- 58
0
votes
1 answer
How can I directly and quickly change all the uid/gid of all files in the git index of a git repository
My use case is that
I have a very large GIT repository created by uidA:gidA with all its files and git index as uidA:gidA
That I have snapshoted/frozen using netapp file system technology aka froze the content of that directory and the git…

Sarvi Shanmugham
- 487
- 4
- 13
0
votes
2 answers
Why does `git update-index` not affect files not in the current directory?
I'm trying to use git update-index --again to re-add modified files to the index. This works fine, but only for files/directories in the current directory. Is this expected behavior for this command or is there any option to make it consider the…

planetp
- 14,248
- 20
- 86
- 160
0
votes
0 answers
Cloning a git repo that will be the upstream parent but I want to make changes to the README for my new project and not ever push that back
I want to base my new project off of an existing git repo.
My intention is not to extend the current project but to start a new project with different aims.
Specifically I want to remove the original README and some of the original folders and make…

Evolve
- 8,939
- 12
- 51
- 63
0
votes
2 answers
Git index file not identical after resetting back - why?
I'm trying to understand how the git index file works.
I have a local repository with some files, one of them test.txt. I was on commit X and saved the index file of that commit to a temp directory.
Then I edited test.txt added and committed it…

caffein
- 303
- 1
- 10
0
votes
1 answer
Undo git update-index --no-assume-unchanged (not working) and be able to see these local changes again
Update:
My permissions issues somehow fixed themselves arbitrarily as now the exact same remote branch create command works, so (as you probably guessed) it wasn't caused by this tracking issue.
Now I'm just looking to fix the tracking issue.…

salemandreus
- 1
- 2