{"thread":{"id":"11046","subject":"Re: can't commit files that have been git add'ed because \"fatal: you need to resolve your current index first\"","startedAt":"2007-11-28T16:55:10Z","lastAt":"2007-11-28T16:55:10Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"61242","messageId":"200711281755.10828.jnareb@gmail.com","threadId":"11046","inReplyTo":"251604.8861.qm@web55007.mail.re4.yahoo.com","subject":"Re: can't commit files that have been git add'ed because \"fatal: you need to resolve your current index first\"","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-11-28T16:55:10Z","receivedAt":"2007-11-28T16:55:10Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Please do not toppost, and try not to break quoted lines, please.\nThanks in advance.\n\nOn Wed, 28 Nov 2007, Bill Priest wrote:\n> --- Jakub Narebski <jnareb@gmail.com> wrote:\n>> Bill Priest wrote:\n>> \n>>>   I merged from one branch to another and had lots of\n>>> conflicts.  I've resolved a set of files from the\n>>> conflicts (in a directory) and did a git-add on this\n>>> set of files.  I wasn't able to commit these files. \n>>> On IRC I was told that all files must be resolved\n>>> before I can commit any of them.  This seems pretty\n>>> limiting.  Why is a commit after a merge all or\n>>> nothing; I thought that git  figured out merges and\n>>> such by the differences between files??\n>> \n>> You have to resolve _conflicts_ only. The rest is\n>> added\n>> automatically. See git-status, git diff --merge,\n>> git ls-files -u.\n\n>    I understand that git requires this.  My question\n> is   git enforcing policy or is there something\n> \"magic\" about a commit after a merge.  What if I want\n> to make an independent change and check it in on the\n> same branch before I am finished with the merge? \n\nA little technical information about failed merge.\n\nFirst, git tries to merge as mauch as it can automatically,\ndoing tree-level merge and trying three-way file-level merge\nif necessary. Everything that merges cleanly is automatically\nadded to staging area.\n\nFor each file that has unresolved conflicts git adds to staging\nare all (three) versions of file: original, from merged in\nbranch, and common ancestor version, as stages 1, 2, 3 (not\nnecessary in this order: see documentation). Additionally it\nleaves partially merged file in working area with RCS-like\nconflicts markes in it. (Note that default checking before\ncommits refuses to check in file with conflict markers; see\ndocumentation how to force commit anyway).\n\nAdditionally git records the fact that it is in the midle of merge\nby recording branch(es) merged in in .git/MERGE_HEAD.\n\n\nTo resolve conflicts you have to bring file to some version,\nremoving conflict markers, add this version using \"git add\",\nthen commit.\n\n\nYou can try to git-stash partially done merge; if it doesn't\nwork send us bugreport.\n\n-- \nJakub Narebski\nPoland\n"}]}