Subject: RE: Use of Git with local folders

From: "Felipe Bustamante" <[email-masked]>
Date: Fri, 26 Apr 2024 17:56:46 +0200

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 <[email-masked]> 
Sent: den 26 april 2024 12:16
To: Felipe Bustamante <[email-masked]>; [email-masked]
Subject: Re: Use of Git with local folders

Hello Felipe,

"Felipe Bustamante" <[email-masked]> 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