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

suggestion? only pull cleanly applying commits

From
MMMaximilian Mehnert <maximilian.mehnert@googlemail.com>
Date
Nov 26, 2008, 11:48 UTC
Message-ID
<492D37A2.4010500@googlemail.com>
Hi!

I've a scenario where I don't really want to do a full merge but rather to pull all commits from another repository that merge without conflicts.

I've put together the script at the bottom which seems to work ok but is damn slow.

Is there a smarter and faster way to do this that I missed reading the documentation?

Any help would be really appreciated! :-)

Regards, Maximilian

#!/bin/sh
for commit in `git rev-list --reverse HEAD..other-repository/master`; do
        git diff-tree -p $commit|patch --dry-run -p1 -N -f >/dev/null
        if [ $? -eq 0 ]; then
                echo "getting $commit"
                parents=`git rev-list --parents -n1  $commit|wc -w`
                if [ $parents -eq 2 ]; then
                        git cherry-pick $commit
                else
                        git cherry-pick -m1 $commit
                fi
        fi
done
Next: Andreas Ericsson
Message 1 of 2 in “suggestion? only pull cleanly applying commits”
  1. Maximilian MehnertNov 26, 2008
  2. Andreas EricssonNov 26, 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.