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
2
votes
1 answer
libgit2-newbie question: What goes in the file tree in a commit?
tl;dr: libgit2-newbie gets confused about indexes in coding commits, eventually decides to ignore the index and just update the commit tree. Please advise if this is wrong.
This is a (libgit2-newbie) question about git internals, using libgit2. I'm…

Martin Ellison
- 1,043
- 1
- 13
- 25
2
votes
2 answers
What is ctime and mtime used for in the git index?
When a file is added to the index for the first time the file’s create timestamp is stored in the index record's ctime and the file's current modified time stamp is stored in the mtime field.
When the file is added after a change, the mtime is…

Rich Shealer
- 3,362
- 1
- 34
- 59
2
votes
1 answer
Ignore local changes in the file and update it on pull
We have a repo with a file say x.APK that is pulled by client machines.
These client machine will modify this file and keep it locally for their use.
In normal usage we will update this file very rarely say once in 2-3 months.
The first time it…

goldsmit409
- 478
- 4
- 26
2
votes
1 answer
Keep ignored files when switching branches in git
Eclipse has it's own files .project, .classpath and .settings folder. In git, I have them in the .gitignore file, because I don't want them to be tracked in the remote repository. My problem is that when I switch branch, and then switch back, those…

carcaret
- 3,238
- 2
- 19
- 37
2
votes
1 answer
What are the "lindex", "rindex" and "wtindex" files generated by git difftool?
When I run:
git difftool -d
It creates a temporary directory containing the files to be shown in the diff. The structure looks like this:
tmpdir/
left/
file1
lindex
right/
file1
rindex
The "left" and "right" directories are clear.…

danvk
- 15,863
- 5
- 72
- 116
2
votes
1 answer
How do I remove a modified file from the git index and discard the modifications in a single step?
I recently performed a sloppy big commit to the wrong branch. I decided that I wanted the changes committed to be on a different branch and to possibly split the big commit into several smaller commits. I performed a git cherry-pick -n as indicated…

Trebor Rude
- 1,904
- 1
- 21
- 31
1
vote
2 answers
Pop conflicting Git stash while keeping stash index
Explanation:
I make a heavy use of Git staging area to keep track of the changes that I'm already sure of while the working directory is often a mess of untested solutions, TODOs and a code that is generally very WIP.
Loosing the distinction between…

Piotr Siupa
- 3,929
- 2
- 29
- 65
1
vote
0 answers
Removing a submodule manually
I tried removing manually the following submodule from my local repository:
components/CtrlFuelSuppHtr
Removed it from these three places: .git folder, components folder, and deleted it on .gitmodules.
But I get the following error when running any…

tadm123
- 8,294
- 7
- 28
- 44
1
vote
0 answers
Git: Could not reset submodule index when checking out
I'm trying to checkout a specific commit ID along with all its submodules.
git checkout --recurse-submodules 7fdb9221d958acda289904951fe6d37873e8cfbf
But I'm getting the following error:
fatal: not a git repository:…

tadm123
- 8,294
- 7
- 28
- 44
1
vote
0 answers
Weird behavior of git switch/checkout if index has same content as target commit
Let's create a small local repository:
git init
echo foo > foo
git add foo
git commit -m foo
git branch bar
echo foo >> foo
git commit -a -m 'another foo'
If we do this now, we replace our file foo in our index as well as in our working copy with…

Michi
- 681
- 1
- 7
- 25
1
vote
1 answer
How can navigate one level back at the git interactive staging (add) command
After running the interactive staging git command $ git add -i and choosing one of the options for example "update", then I don't know how to get back to the root level to choose another option.
Is there any keyboard shortcuts or alternative methods…

muel
- 43
- 1
- 13
1
vote
2 answers
Why do I need to tell git I've removed a file?
I'm building a historical record of development into git from saved zip files. I'm happy about the need to git add . files to the staging area so that the selected files are committed. So far so good.
However I'm now in the situation of simply…

Philip Oakley
- 13,333
- 9
- 48
- 71
1
vote
2 answers
How does Git restore index and wokring directory internally (upon reset/checkout)?
I understand that when I checkout or reset --hard to a specific commit/branch then I get the relevant contents in my working directory and the index file.
But how does Git internally re-build the index and working directory contents upon checkout or…

caffein
- 303
- 1
- 10
1
vote
1 answer
Undo "git update-index --assume-unchanged" is not working (in conjunction with --no-skip-worktree)
I have read Undo git update-index --assume-unchanged file, but alas, nothing does work:
whatever/.idea > git ls-files -v
S ant.xml
I tried:
git update-index --no-assume-unchanged --no-skip-worktree ant.xml
Just completes, but when I do git…

GhostCat
- 137,827
- 25
- 176
- 248
1
vote
1 answer
Git - Have untracked files in online repository
I'm using git (bitbucket) to source control my linux configuration files. All the files are in the directory ~/.cfg/. Then I additionally have some local configuration files in ~/.cfg/local/ which are supposed to be different from machine to…

Mate de Vita
- 1,102
- 12
- 32