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

cherry picking changesets instead of commits

From
Geoffrey Irving <irving@naml.us>
Date
May 28, 2008, 18:06 UTC
Message-ID
<7f9d599f0805281106w746a0469u6c483d64cf75b823@mail.gmail.com>

I have a project stored in a git repository with other versions stored in both cvs and perforce (sadly). I want the ability to propagate changes back and forth between all three repositories without mangling the git history. I specifically want to avoid (1) having two copies of each commit (e.g., an initial version and a version pulled from cvsimport) and (2) commits full of git-p4 metadata (the [git-p4] lines in commit messages).

One way to do this would be to have cvs branch imported using "git cvsimport", and a perforce branch imported via "git-p4", and communicate between the cvs/p4 branches and the main git branches entirely through cherry picking. Unfortunately, "git cherry" doesn't recognize when commits with potentially different author names or log messages polluted with "[git-p4]" produce the same changeset, so if I export a change from the git master branch through cvsexportcommit and update the cvs branch with cvsimport, "git cherry" will report that the change doesn't exist on the git master branch.

Has anyone tackled this problem before? Would it be straightforward to add an option to "git cherry" to ignore differences in metadata? The cherry documentation doesn't give its criteria for when commits match, and I'm not familiar enough with the code yet to figure out those criteria directly from cmd_cherry in builtin-log.c.

Thanks, Geoffrey

Next: Junio C Hamano
Message 1 of 13 in “cherry picking changesets instead of commits”
  1. Geoffrey IrvingMay 28, 2008
  2. Junio C HamanoMay 28, 2008
  3. Geoffrey IrvingMay 28, 2008
  4. Junio C HamanoMay 28, 2008
  5. Geoffrey IrvingMay 28, 2008
  6. Junio C HamanoMay 28, 2008
  7. Geoffrey IrvingMay 28, 2008
  8. Jeff KingMay 28, 2008
  9. Jeff KingMay 28, 2008
  10. Junio C HamanoMay 28, 2008
  11. Jeff KingMay 29, 2008
  12. Documentation: git-cherry uses git-patch-idJunio C Hamano, May 29, 2008
  13. Geoffrey IrvingMay 29, 2008

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.