Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Beat Bolli <dev+git@drbeat.li>
Cc: Felipe Bustamante <fisadmaster@gmail.com>,
	 git@vger.kernel.org, 'Karthik Nayak' <karthik.188@gmail.com>
Subject: Re: Use of Git with local folders
Date: Sat, 27 Apr 2024 10:14:41 -0700	[thread overview]
Message-ID: <xmqqv842683i.fsf@gitster.g> (raw)
In-Reply-To: <30c5852e-c8db-433c-871b-1ae5c87034dc@drbeat.li> (Beat Bolli's message of "Sat, 27 Apr 2024 18:08:50 +0200")

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.

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.



  reply	other threads:[~2024-04-27 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 16:19 Use of Git with local folders Felipe Bustamante
2024-04-26 10:16 ` Karthik Nayak
2024-04-26 15:56   ` Felipe Bustamante
2024-04-27 16:08     ` Beat Bolli
2024-04-27 17:14       ` Junio C Hamano [this message]
2024-04-27 22:02         ` Beat Bolli
2024-04-29 15:44           ` Felipe Bustamante
  -- strict thread matches above, loose matches on Subject: below --
2024-04-29 15:47 Felipe Bustamante

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqv842683i.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=dev+git@drbeat.li \
    --cc=fisadmaster@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).