below is my understanding from reading the parts of code as suggested on IRC. what is the use of ce_stage macro ? tells about stage of an index entry. if ce_stage says, stage #0 i.e staging area, then that index entry is in staging area and nothing needs to be done. else a temporary index entry is created and repo_read_index_unmerged() calls other function and tries to add it to index. if it fails, it issues an error. is this correct interpretation ? 1) in repo_read_index_unmerged(), why don't we make the value of `unmerged` 0, if adding index entry is successful; as the entry is no longer unmerged ? 2) what is ADD_CACHE_SKIP_DFCHECK ? i am unsure if i get its meaning, cache.h says that it means "Ok to skip DF conflict checks" what are DF conflict checks ? something about diffing to check for conflicts ? if so why are we skipping it this entry had conflicts in the past maybe it will create again. 3) what is cache_nr variable in index_state struct ? what is its use ? Now, about add_index_entry_with_check(), i don't fully understand this function but concentrating on the part pointed by dscho. https://github.com/git/git/blob/v2.21.0/read-cache.c#L1284-L1294 /* * Inserting a merged entry ("stage 0") into the index * will always replace all non-merged entries.. */ so this is the part we need to play with for the project https://git.github.io/SoC-2019-Ideas/#teach-git-stash-to-handle-unmerged-index-entries try and change this in some-way to not replace those unmerged entries or store them some place else ?