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

Re: exporting the last N days of a repository

From
BHBob Hiestand <bob.hiestand@gmail.com>
Date
Nov 5, 2008, 00:18 UTC
Message-ID
<cc29171c0811041618jfbcb293l42a19805f06803a0@mail.gmail.com>
In-Reply-To
<93c3eada0811041449u20e0fc74gf6a1cb420923e484@mail.gmail.com>

On Tue, Nov 4, 2008 at 4:49 PM, Geoff Russell <geoffrey.russell@gmail.com> wrote:

Show 24 quoted lines
> Apologies to Johannes and Bob who have tried to help
> but I'm still having difficulties, here is my current non-working script:
>
> ------------------------------------------------------------------
> #!/bin/sh
> DIR=/tmp/gitdemo
> # for testing just arbitrarily
> # select the 15th most recent commit as our new origin
> NEWORIGIN=$(git rev-list master@{15} | head -1)
> echo $NEWORIGIN
> # checkout earlist point we are interested in
> # we want to drop any history before this point
> git checkout $NEWORIGIN
> # now make a new directory, initialise with new origin
> # and apply all commits after that point
> mkdir $DIR && (cd $DIR ; git init) &&  \
>    rsync -aHv --exclude=.git ./ $DIR && \
>    (cd $DIR ; git add . ; git commit -m "starting point" </dev/null ) && \
>    git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )
>
> ----------------- end of script
>
> The fast-import gives me a message I don't understand and doesn't
> do the import.

If I understood your requirement (I know nothing about fast-export), it would look like this:

#!/bin/sh
DIR=/tmp/gitdemo
ORIGDIR=$PWD
git checkout -b shorthistory
NEWORIGIN=$(git rev-list --since='5 months ago' --reverse HEAD| head -1)
echo $NEWORIGIN
git filter-branch --parent-filter '
        test $GIT_COMMIT = '$NEWORIGIN' &&
        echo || cat' \
        --tag-name-filter cat $NEWORIGIN^..
mkdir $DIR
cd $DIR
git init
git fetch $ORIGDIR shorthistory:master
Thank you,
bob
Previous: Geoff RussellNext: Geoff Russell
Message 6 of 8 in “exporting the last N days of a repository”
  1. Geoff RussellOct 29, 2008
  2. Johannes SchindelinOct 29, 2008
  3. Geoff RussellNov 3, 2008
  4. Johannes SchindelinNov 3, 2008
  5. Geoff RussellNov 4, 2008
  6. Bob HiestandNov 5, 2008
  7. Geoff RussellNov 5, 2008
  8. Bob HiestandNov 5, 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.