From: Jakub Narebski <jnareb@gmail.com>
To: Bill Priest <priestwilliaml@yahoo.com>
Cc: git@vger.kernel.org
Subject: Re: can't commit files that have been git add'ed because "fatal: you need to resolve your current index first"
Date: Wed, 28 Nov 2007 17:55:10 +0100 [thread overview]
Message-ID: <200711281755.10828.jnareb@gmail.com> (raw)
In-Reply-To: <251604.8861.qm@web55007.mail.re4.yahoo.com>
Please do not toppost, and try not to break quoted lines, please.
Thanks in advance.
On Wed, 28 Nov 2007, Bill Priest wrote:
> --- Jakub Narebski <jnareb@gmail.com> wrote:
>> Bill Priest wrote:
>>
>>> I merged from one branch to another and had lots of
>>> conflicts. I've resolved a set of files from the
>>> conflicts (in a directory) and did a git-add on this
>>> set of files. I wasn't able to commit these files.
>>> On IRC I was told that all files must be resolved
>>> before I can commit any of them. This seems pretty
>>> limiting. Why is a commit after a merge all or
>>> nothing; I thought that git figured out merges and
>>> such by the differences between files??
>>
>> You have to resolve _conflicts_ only. The rest is
>> added
>> automatically. See git-status, git diff --merge,
>> git ls-files -u.
> I understand that git requires this. My question
> is git enforcing policy or is there something
> "magic" about a commit after a merge. What if I want
> to make an independent change and check it in on the
> same branch before I am finished with the merge?
A little technical information about failed merge.
First, git tries to merge as mauch as it can automatically,
doing tree-level merge and trying three-way file-level merge
if necessary. Everything that merges cleanly is automatically
added to staging area.
For each file that has unresolved conflicts git adds to staging
are all (three) versions of file: original, from merged in
branch, and common ancestor version, as stages 1, 2, 3 (not
necessary in this order: see documentation). Additionally it
leaves partially merged file in working area with RCS-like
conflicts markes in it. (Note that default checking before
commits refuses to check in file with conflict markers; see
documentation how to force commit anyway).
Additionally git records the fact that it is in the midle of merge
by recording branch(es) merged in in .git/MERGE_HEAD.
To resolve conflicts you have to bring file to some version,
removing conflict markers, add this version using "git add",
then commit.
You can try to git-stash partially done merge; if it doesn't
work send us bugreport.
--
Jakub Narebski
Poland
next parent reply other threads:[~2007-11-28 16:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <251604.8861.qm@web55007.mail.re4.yahoo.com>
2007-11-28 16:55 ` Jakub Narebski [this message]
2007-11-30 16:32 can't commit files that have been git add'ed because "fatal: you need to resolve your current index first" Bill Priest
-- strict thread matches above, loose matches on Subject: below --
2007-11-29 4:10 Bill Priest
[not found] <993937.9873.qm@web55013.mail.re4.yahoo.com>
2007-11-28 18:11 ` Jakub Narebski
2007-11-28 15:48 Bill Priest
2007-11-28 15:53 ` Jakub Narebski
2007-11-28 20:08 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200711281755.10828.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=priestwilliaml@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).