git/list[1] front-page[2] threads[3] people[4] search[5] about
 

commit/from command in git-fast-import

From
Mike Hommey <mh@glandium.org>
Date
Jan 27, 2012, 12:48 UTC
Message-ID
<20120127124837.GA24084@glandium.org>
Hi,

I'm trying to make sense of the git fast-import manual page. This is what it reads, as of git 1.7.8.3, from Debian unstable:

  Omitting the from command in the first commit of a new branch will
  cause fast-import to create that commit with no ancestor. This
  tends to be desired only for the initial commit of a project. If
  the frontend creates all files from scratch when making a new
  branch, a merge command may be used instead of from to start the
  commit with an empty tree. Omitting the from command on existing
  branches is usually desired, as the current commit on that branch
  is automatically assumed to be the first ancestor of the new
  commit.
When I do create a commit on a given branch with a stream like:
  commit refs/heads/branch
  author ...
  committer ...
  data <<EOF
  Commit message
  EOF
  deleteall
All I get is this warning:
  warning: Not updating refs/heads/branch (new tip new_sha1
does not contain old_sha1)

And the branch only has one commit, which is the one I just created. On the other hand, if I add a "from" instruction in the above stream, I have the expected branch history.

Arguably, this may be related to my use of deleteall, but nothing in the deleteall description suggests this would happen.

Is it an expected behaviour and a lack of proper documentation, or is it a bug in git fast-import ?

Mike
Next: David Barr
Message 1 of 6 in “commit/from command in git-fast-import”
  1. Mike HommeyJan 27, 2012
  2. David BarrJan 27, 2012
  3. Mike HommeyJan 27, 2012
  4. David BarrJan 27, 2012
  5. Jonathan NiederJan 27, 2012
  6. Sverre RabbelierJan 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.