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

Re: Use of Git with local folders

From
Beat Bolli <dev+git@drbeat.li>
Date
Apr 27, 2024, 22:02 UTC
Message-ID
<c40c7a11-6d5c-4d93-8675-93b505a38e64@drbeat.li>
In-Reply-To
<xmqqv842683i.fsf@gitster.g>
On 27.04.2024 19:14, Junio C Hamano wrote:
Show 17 quoted lines
> Beat Bolli <dev+git@drbeat.li> writes:
> 
>> What would work in my opinion is this, if I understand you correctly:
>>
>> 1. In the Git repo of day 1, remove all files except for the .git
>> folder. This is to make sure ...
>> 4. Continue from step 1 for each remaining day.
>>
>> This will result in one repository that has one commit per day. Going
>> forward, you'd probably want to commit more often so that your commits
>> comprise a meaningful unit of work instead of arbitrary day
>> boundaries.
> 
> Hmph, perhaps I am misunderstanding things, but I didn't read in the
> original or the follow-up from the OP any wish to "squash" a day's
> worth of activities into a single commit each.
> 

I guess my brain just implied from those daily copies that there was just one commit at the end of the day.

Your explanation below makes more sense.
Show 56 quoted lines
> Let me make sure what I understood from the follow-up from the OP is
> not too far away from the reality.  I thought the day's activity is
> 
>   * The whole "repository + working tree" from day (N-1) is copied
>     into a new "repository + working tree" for day N, to let the user
>     to play in. Then the user hacks away, creating commits on top of
>     the HEAD.
> 
> So there may be a directory structure
> 
>   - FBustamante/
>     - Day-01/
>       - .git/
>       - COPYING
>       - ...
>     - Day-02/
>       - .git/
>       - COPYING
>     ...
>     - Day-10/
>       - .git/
>       - COPYING
>       - ...
> 
> but Day-10/.git has ALL the history for everything.  Day-10/.git
> is a superset of Day-09/.git, which in turn is a superset of
> Day-08/.git, etc. all the way down to Day-01/.git/.
> 
> If that is the case, and if the end state of each day needs to be
> given a "label" so that it is easily discoverable, then what I would
> do would be something like:
> 
>      $ cd FBustamante
>      $ cp -a Day-10 ALL
> 
> to first prepare an exact copy of Day-10 in ALL, and then
> 
>      $ for d in Day-??
>        do
> 	rev=$(git -C "$d" rev-parse HEAD)
> 	git -C ALL tag "$d" "$rev"
>        done
> 
> to go in to each day's repository to grab its HEAD, and make a tag
> for that commit in the ALL repository.
> 
> Then doing the usual things like
> 
>      $ cd ALL
>      $ git log Day-01
>      $ git log Day-02..Day-04
> 
> should give us what happend on the first day, what happened on the
> third and fourth day, etc., as expected.
> 
> 
Previous: Junio C HamanoNext: Felipe Bustamante
Message 6 of 7 in “Use of Git with local folders”
  1. Felipe BustamanteApr 25, 2024
  2. Karthik NayakApr 26, 2024
  3. Felipe BustamanteApr 26, 2024
  4. Beat BolliApr 27, 2024
  5. Junio C HamanoApr 27, 2024
  6. Beat BolliApr 27, 2024
  7. Felipe BustamanteApr 29, 2024

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.