git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Use of Git with local folders
@ 2024-04-25 16:19 Felipe Bustamante
  2024-04-26 10:16 ` Karthik Nayak
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Bustamante @ 2024-04-25 16:19 UTC (permalink / raw)
  To: git

Hi,

I would like to know if it is possible to combine the contents of several directories with copies of the same source code but with different changes?

The stage is:
1. There is a directory with the original source code, without changes.
2. There are several directories, ordered by the date of creation, which are a copy of the original source code, copies made every day after generating changes, that is, the original source code resides in the DIR1 directory, a copy is made with name dir2, and changes are made to the source code of the project. The next day, a copy of the directory of name DIR2 is made and renamed DIR3, we work with this directory making changes to the source code. The same process is carried out for two weeks.

The important question would be, is it possible to combine these directories in a repository with a Master branch (the first original directory (DIR1) and transform the other directory into branches of the master?

It would be useful, if copies were made that were made on an original directory (dir1) that was already becoming a git repository, with the use of Visual Studio 2022?

As an observation, the work is done on an isolated computer, without internet connection or to backup devices, the computer is fully isolated and it is necessary to generate the version control, in the case that it is possible.

Any orientation in this regard would be very useful.

Thanks,

Felipe Bustamante
Sverige


--
This email has been checked for viruses by AVG antivirus software.
www.avg.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Use of Git with local folders
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Karthik Nayak @ 2024-04-26 10:16 UTC (permalink / raw)
  To: Felipe Bustamante, git

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

Hello Felipe,

"Felipe Bustamante" <fisadmaster@gmail.com> writes:
> Hi,
>
> I would like to know if it is possible to combine the contents of several directories with copies of the same source code but with different changes?
>
> The stage is:
> 1. There is a directory with the original source code, without changes.
> 2. There are several directories, ordered by the date of creation, which are a copy of the original source code, copies made every day after generating changes, that is, the original source code resides in the DIR1 directory, a copy is made with name dir2, and changes are made to the source code of the project. The next day, a copy of the directory of name DIR2 is made and renamed DIR3, we work with this directory making changes to the source code. The same process is carried out for two weeks.
>
> The important question would be, is it possible to combine these directories in a repository with a Master branch (the first original directory (DIR1) and transform the other directory into branches of the master?
>
> It would be useful, if copies were made that were made on an original directory (dir1) that was already becoming a git repository, with the use of Visual Studio 2022?
>
> As an observation, the work is done on an isolated computer, without internet connection or to backup devices, the computer is fully isolated and it is necessary to generate the version control, in the case that it is possible.
>
> Any orientation in this regard would be very useful.
>
> Thanks,
>
> Felipe Bustamante
> Sverige
>

I'm not sure I fully grasp the problem, especially around why these
copies are made in such a way.

But, have you looked at 'git-worktree'? This would allow you to do
something like

$ cd dir1
$ git worktree add -b branch2 ../dir2

Once done with dir2, you can remove the worktree

$ git worktree remove ../dir2

But the branch ('branch2') would still remain and you can merge the
branch as needed.

I hope that helps

- Karthik

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Use of Git with local folders
  2024-04-26 10:16 ` Karthik Nayak
@ 2024-04-26 15:56   ` Felipe Bustamante
  2024-04-27 16:08     ` Beat Bolli
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Bustamante @ 2024-04-26 15:56 UTC (permalink / raw)
  To: 'Karthik Nayak', git

Hi Karthik,

Thanks for the reply.

What you indicate allows me to create a relationship between a new branch and a new empty local directory, but what I need is to relate a branch with an existing local directory since the latter contains the changes made to the source code and I need to generate change control.

I am going to clarify the working conditions to explain why we have worked in this way.

The computer for development is in a completely isolated work environment, without connection to any data network, all data ports are disabled (network, USB, Bluetooth, etc.) so there is no possibility of copying the code. source towards a more open environment.

This computer only has Visual Studio 2022 installed, no other type of software has been installed, which is why it is impossible to create branches from the master since VS 2022 does not allow branches connected to local directories.

The only way that could be used to isolate daily changes was to create a directory each day, by means of a copy from Windows File Explorer, containing the changes made during the last and previous days.

The structure of the project would be as follows:

1. CS_2024-04-10 directory, this is the original directory containing the original source code. This directory was converted to a GIT repository using VS 2022 which allows us to have the master branch. Because of the above, this directory contains the hidden .git directory.
2. The next day, a copy of the original directory was made, and this copy was named CS_2024-04-11. Because of this, this directory contains the hidden .git directory of the original. We worked on this copy by opening the project in VS 2022 and making various changes and then saving the results.

3. The previous process has been carried out for two weeks, so there are 10 source code directories which include the changes made during each workday plus the changes from the respective previous day, for example, the directory CS_2024-04- 16 contains all the changes made from day 10 to day 15 plus the changes made during day 16.

Now, what we need is to know if it is possible to convert all these sequential directories into a GIT structure with change control such as the first directory with the master branch and then branches that can be associated with each subsequent directory.

I have installed, to support the idea, the GIT program. For this reason, now the development computer only contains two software for development, Visual Studio 2022, and GIT.

How would it be possible to create branches from the master branch, using the original directory CS_2024-04-10 and associate these branches with the sequential directories created?

Thank you very much for the help.

Felipe Bustamante
Sverige

-----Original Message-----
From: Karthik Nayak <karthik.188@gmail.com>
Sent: den 26 april 2024 12:16
To: Felipe Bustamante <fisadmaster@gmail.com>; git@vger.kernel.org
Subject: Re: Use of Git with local folders

Hello Felipe,

"Felipe Bustamante" <fisadmaster@gmail.com> writes:
> Hi,
>
> I would like to know if it is possible to combine the contents of several directories with copies of the same source code but with different changes?
>
> The stage is:
> 1. There is a directory with the original source code, without changes.
> 2. There are several directories, ordered by the date of creation, which are a copy of the original source code, copies made every day after generating changes, that is, the original source code resides in the DIR1 directory, a copy is made with name dir2, and changes are made to the source code of the project. The next day, a copy of the directory of name DIR2 is made and renamed DIR3, we work with this directory making changes to the source code. The same process is carried out for two weeks.
>
> The important question would be, is it possible to combine these directories in a repository with a Master branch (the first original directory (DIR1) and transform the other directory into branches of the master?
>
> It would be useful, if copies were made that were made on an original directory (dir1) that was already becoming a git repository, with the use of Visual Studio 2022?
>
> As an observation, the work is done on an isolated computer, without internet connection or to backup devices, the computer is fully isolated and it is necessary to generate the version control, in the case that it is possible.
>
> Any orientation in this regard would be very useful.
>
> Thanks,
>
> Felipe Bustamante
> Sverige
>

I'm not sure I fully grasp the problem, especially around why these copies are made in such a way.

But, have you looked at 'git-worktree'? This would allow you to do something like

$ cd dir1
$ git worktree add -b branch2 ../dir2

Once done with dir2, you can remove the worktree

$ git worktree remove ../dir2

But the branch ('branch2') would still remain and you can merge the branch as needed.

I hope that helps

- Karthik


--
This email has been checked for viruses by AVG antivirus software.
www.avg.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Use of Git with local folders
  2024-04-26 15:56   ` Felipe Bustamante
@ 2024-04-27 16:08     ` Beat Bolli
  2024-04-27 17:14       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Beat Bolli @ 2024-04-27 16:08 UTC (permalink / raw)
  To: Felipe Bustamante, git; +Cc: 'Karthik Nayak'

Hi Felipe

[please don't top-post]

On 26.04.2024 17:56, Felipe Bustamante wrote:
> Hi Karthik,
> 
> Thanks for the reply.
> 
> What you indicate allows me to create a relationship between a new
> branch and a new empty local directory, but what I need is to relate
> a branch with an existing local directory since the latter contains
> the changes made to the source code and I need to generate change
> control.
> 
> I am going to clarify the working conditions to explain why we have
> worked in this way.
> 
> The computer for development is in a completely isolated work
> environment, without connection to any data network, all data ports
> are disabled (network, USB, Bluetooth, etc.) so there is no
> possibility of copying the code. source towards a more open
> environment.
> 
> This computer only has Visual Studio 2022 installed, no other type of
> software has been installed, which is why it is impossible to create
> branches from the master since VS 2022 does not allow branches
> connected to local directories.
> 
> The only way that could be used to isolate daily changes was to
> create a directory each day, by means of a copy from Windows File
> Explorer, containing the changes made during the last and previous
> days.
> 
> The structure of the project would be as follows:
> 
> 1. CS_2024-04-10 directory, this is the original directory containing
> the original source code. This directory was converted to a GIT
> repository using VS 2022 which allows us to have the master branch.
> Because of the above, this directory contains the hidden .git
> directory. 2. The next day, a copy of the original directory was
> made, and this copy was named CS_2024-04-11. Because of this, this
> directory contains the hidden .git directory of the original. We
> worked on this copy by opening the project in VS 2022 and making
> various changes and then saving the results.
> 
> 3. The previous process has been carried out for two weeks, so there
> are 10 source code directories which include the changes made during
> each workday plus the changes from the respective previous day, for
> example, the directory CS_2024-04- 16 contains all the changes made
> from day 10 to day 15 plus the changes made during day 16.
> 
> Now, what we need is to know if it is possible to convert all these
> sequential directories into a GIT structure with change control such
> as the first directory with the master branch and then branches that
> can be associated with each subsequent directory.
> 
> I have installed, to support the idea, the GIT program. For this
> reason, now the development computer only contains two software for
> development, Visual Studio 2022, and GIT.
> 
> How would it be possible to create branches from the master branch,
> using the original directory CS_2024-04-10 and associate these
> branches with the sequential directories created?
> 
> Thank you very much for the help.
> 
> Felipe Bustamante Sverige
> 
> -----Original Message----- From: Karthik Nayak
> <karthik.188@gmail.com> Sent: den 26 april 2024 12:16 To: Felipe
> Bustamante <fisadmaster@gmail.com>; git@vger.kernel.org Subject: Re:
> Use of Git with local folders
> 
> Hello Felipe,
> 
> "Felipe Bustamante" <fisadmaster@gmail.com> writes:
>> Hi,
>> 
>> I would like to know if it is possible to combine the contents of
>> several directories with copies of the same source code but with
>> different changes?
>> 
>> The stage is: 1. There is a directory with the original source
>> code, without changes. 2. There are several directories, ordered by
>> the date of creation, which are a copy of the original source code,
>> copies made every day after generating changes, that is, the
>> original source code resides in the DIR1 directory, a copy is made
>> with name dir2, and changes are made to the source code of the
>> project. The next day, a copy of the directory of name DIR2 is made
>> and renamed DIR3, we work with this directory making changes to the
>> source code. The same process is carried out for two weeks.
>> 
>> The important question would be, is it possible to combine these
>> directories in a repository with a Master branch (the first
>> original directory (DIR1) and transform the other directory into
>> branches of the master?
>> 
>> It would be useful, if copies were made that were made on an
>> original directory (dir1) that was already becoming a git
>> repository, with the use of Visual Studio 2022?
>> 
>> As an observation, the work is done on an isolated computer,
>> without internet connection or to backup devices, the computer is
>> fully isolated and it is necessary to generate the version control,
>> in the case that it is possible.
>> 
>> Any orientation in this regard would be very useful.

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 that any files that are no longer present 
on the next day are really no longer in the repo.

2. Copy the content of day 2 except the .git folder over into day 1. git 
status, git diff etc should show the differences between days 1 and 2.

3. Create a new branch for this day, and commit all changes.

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.

It does not matter that your system is air-gapped. Git works perfectly 
locally without ever fetching or pushing.

By the way, I don't think it's necessary to create a new branch each 
day; you can inspect the history just as well by only committing.


HTH

-- 
Cheers, Beat



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Use of Git with local folders
  2024-04-27 16:08     ` Beat Bolli
@ 2024-04-27 17:14       ` Junio C Hamano
  2024-04-27 22:02         ` Beat Bolli
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2024-04-27 17:14 UTC (permalink / raw)
  To: Beat Bolli; +Cc: Felipe Bustamante, git, 'Karthik Nayak'

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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Use of Git with local folders
  2024-04-27 17:14       ` Junio C Hamano
@ 2024-04-27 22:02         ` Beat Bolli
  2024-04-29 15:44           ` Felipe Bustamante
  0 siblings, 1 reply; 8+ messages in thread
From: Beat Bolli @ 2024-04-27 22:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Felipe Bustamante, git, 'Karthik Nayak'

On 27.04.2024 19:14, Junio C Hamano wrote:
> 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.

> 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.
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Use of Git with local folders
  2024-04-27 22:02         ` Beat Bolli
@ 2024-04-29 15:44           ` Felipe Bustamante
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Bustamante @ 2024-04-29 15:44 UTC (permalink / raw)
  To: 'Beat Bolli', 'Junio C Hamano'
  Cc: git, 'Karthik Nayak'

Hi Beat,

-----Original Message-----
From: Beat Bolli <dev+git@drbeat.li>
Sent: den 28 april 2024 00:03
To: Junio C Hamano <gitster@pobox.com>
Cc: Felipe Bustamante <fisadmaster@gmail.com>; git@vger.kernel.org; 'Karthik Nayak' <karthik.188@gmail.com>
Subject: Re: Use of Git with local folders

On 27.04.2024 19:14, Junio C Hamano wrote:
> 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.

> 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.
>
>

The technique suggested by Junio C Hamano resulted in a resf error when executing the for, which did not allow me to obtain the expected result.

On the other hand, the technique that you have suggested to me did give the expected results and now has a master and all the commits made for two weeks.

Thank you very much for the help, everyone,

Felipe Bustamante
Sverige


--
This email has been checked for viruses by AVG antivirus software.
www.avg.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Use of Git with local folders
@ 2024-04-29 15:47 Felipe Bustamante
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Bustamante @ 2024-04-29 15:47 UTC (permalink / raw)
  To: 'Beat Bolli', 'Junio C Hamano'
  Cc: git, 'Karthik Nayak'

Hi Beat,

The technique suggested by Junio C Hamano resulted in a resf error when executing the for, which did not allow me to obtain the expected result.

On the other hand, the technique that you have suggested to me did give the expected results and now has a master and all the commits made for two weeks.

Thank you very much for the help, everyone,


Felipe Bustamante
Sverige



--
This email has been checked for viruses by AVG antivirus software.
www.avg.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-29 15:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).