Questions tagged [git-index]

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.

89 questions
5
votes
3 answers

Git: What is the index

From this picture, a commit is a pointer to the root tree which is a pointer to other trees and blobs. But what is a proper view of the index? Questions: Is it a similar tree-ish with folder structures or just a flat view of blobs? If the index…
Cyker
  • 9,946
  • 8
  • 65
  • 93
4
votes
1 answer

How can I recover from "invalid sha1 pointer in resolve-undo" with git fsck?

I run git gc in a repository and get a fatal error: Enumerating objects: 2382, done. Counting objects: 100% (2382/2382), done. Delta compression using up to 8 threads Compressing objects: 100% (747/747), done. fatal: unable to read…
Joe
  • 29,416
  • 12
  • 68
  • 88
4
votes
2 answers

Why does git make new blobs between 'git add' commands?

So I've recently discovered the tool git cat-file and I've been playing around with it. I know that git uses blobs to store the actual content. But why does it seem to create a new blob every time I git add a change to a file, i.e. as opposed to…
Donald
  • 693
  • 1
  • 7
  • 12
4
votes
1 answer

what is "stat information" in a git index?

In git documentation (like git-checkout-index http://linux.die.net/man/1/git-checkout-index ), there are references to "stat information" in the index file. What is this mysterious "stat information"?
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
4
votes
2 answers

Why does checkout sometimes stage a file?

When I first started using Git, I found the checkout command quite confusing. However, as I adapted to Git's model of version control, it started to make sense. Now I am having to teach Git to my coworkers, and I'm trying to explain checkout simply.…
Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
4
votes
2 answers

Why is the git index file binary?

Most of the files in my Git directory are plain text files (except for the compressed loose objects and the packfiles). So I can just cat and edit files like .git/HEAD or .git/refs/heads/master and inspect the repository if it gets corrupted. But…
das_j
  • 4,444
  • 5
  • 31
  • 47
3
votes
1 answer

Is it possible to apply single lines from stash?

I'm looking for a way to include specific parts of stashes in stage. I'm using TIG frontend, so the method can involve some low level offset, etc. calculation. However currently I don't have any idea of what to compute. Does someone have an idea of…
psprint
  • 349
  • 1
  • 10
3
votes
1 answer

Why does git checkout file behave like reset staged file followed by checkout unstaged file?

I've come across this statement in git documentation: Checking out a file is similar to using git reset with a file path, except it updates the working directory instead of the…
caffein
  • 303
  • 1
  • 10
3
votes
1 answer

How to swap the content of a file in the working directory with the content of a previously staged version of this file?

Is it possible to exchange the index state of a certain file with its working tree content?
Mot
  • 28,248
  • 23
  • 84
  • 121
3
votes
3 answers

Why does Git need to design Index /Stage?

The following image is Git flow diagram, I'm very strange why Git need to design Index /Stage. You know the communication between Repository and Workspace is local, it's easy to commit or rollback between Repository and Workspace. Why does Git need…
HelloCW
  • 843
  • 22
  • 125
  • 310
3
votes
2 answers

Show files that are in Git's index and changed in the working copy

I have a Git pre-commit hook which strips whitespace and leaves the modified files in the working copy, so that it doesn't stomp on a partial add like git add -p. If I commit one file out of many changed, and whitespace is corrected, I then have two…
Inductiveload
  • 6,094
  • 4
  • 29
  • 55
3
votes
2 answers

git - revert update-index/ignored file so I can change branch?

I was trying to add an error log to my .gitignore file, and somewhere along the way read that I had to specifically untrack the file after adding it to .gitignore. Somehow, I wound up using this to do so: git update-index --assume-unchanged…
jleach
  • 7,410
  • 3
  • 33
  • 60
3
votes
1 answer

How to start tracking directories/files again which were removed from git index?

Using below command i removed few directories from git index: git rm -r --cached Now how can i add those untracked directories to git index again?
learner
  • 786
  • 7
  • 17
3
votes
2 answers

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

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. Project Explorer --> Team…
unknown
  • 4,859
  • 10
  • 44
  • 62
3
votes
3 answers

I ran git update-index --assume-unchanged and now want to get the list of files?

I temporarily wanted to get rid of some files for a certain commit and ran: git update-index --assume-unchanged file_name on a bunch of files. Then I closed my terminal, is there anyway of getting back the names of files that I ran the git…
Jamal Khan
  • 9,371
  • 6
  • 23
  • 23