POV-Ray : Newsgroups : povray.off-topic : Git branches on local machine? : Re: Git branches on local machine? Server Time
27 Apr 2024 12:38:39 EDT (-0400)
  Re: Git branches on local machine?  
From: Jim Henderson
Date: 24 Oct 2021 15:09:15
Message: <pan$34098$b2362bb3$333a2af2$3fb4cfbf@nospam.com>
On Sat, 23 Oct 2021 23:11:32 -0400, Cousin Ricky wrote:

> On 2021-10-13 7:22 PM (-4), Jim Henderson wrote:
>> On Sat, 23 Oct 2021 19:17:07 -0400, Cousin Ricky wrote:
>> 
>>> There is something I don't understand about Git branches.
>>>
>>> I have some projects that have been on my hard disk for years, but
>>> have just recently converted to Git repositories.  I want to start a
>>> branch on one of them.  My understanding is that Git tracks changes in
>>> both the main/master branch and the new branch.  But I only have one
>>> working copy of the actual files in my directory.  Which branch do
>>> these files represent, and where are the files of the other branch? 
>>> How does this all work?
>> 
>> The only change tracking is on the active branch.  If you're working
>> outside of master, no changes you make are recorded in master unless
>> you either do a cherry pick or a merge - in either case, at the point
>> of the merge or cherry pick, the changes you've made (or selected, in
>> the case of a cherry pick) are brought into the target branch (can be
>> master, can be some other branch).
>> 
>> In git, you're only ever working in a single branch, ever.
> 
> But which branch are my files attached to?  If I switch branches, where
> are the files in the new branch that I want to edit?

The branch that's active is where your files are, assuming you did a 'git 
add' (or equivalent).  With git, you have to tell it that you've added 
new files so it will track them.

If you switch branches, the files are in the branch where you added them 
- and only in that branch.



-- 
"I learned long ago, never to wrestle with a pig. You get dirty, and 
besides, the pig likes it." - George Bernard Shaw


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.