Home > Software engineering >  GIT rebase says that file was deleted in HEAD but it has only been updated
GIT rebase says that file was deleted in HEAD but it has only been updated

Time:11-23

When completing a rebase on a branch git rebase branch master the file I have been editing on the branch no longer has my changes and the log states:

CONFLICT (modify/delete): client/src/pages/Section/index.js deleted in HEAD 
and modified in 279afb1 (create content pages). Version 279afb1 (create content pages) 
of client/src/pages/Section/index.js left in tree.

The file in question (client/src/pages/Section/index.js) is present in my branch and has not been deleted.

Any suggestions on how I can resolve this?

CodePudding user response:

Files are not "in branches": specific files are in, or absent from, specific commits. Those commits are then contained in branches, but any given commit can be in many branches at the same time, or even in no branches at all. So don't think of this as "the file isn't in the branch": think of this as "the file isn't in the commit", because that's the case here.

Now, the commit in question is HEAD, and HEAD is tricky during rebase. This is because Git forces you to be a Git Mechanic, as if instead of just hopping into a taxicab and saying "take me to Paris", you have to first assemble the taxi from Lego parts, then assemble the driver, and then direct him to each turn, one step at a time.

  • Related