Question

Can I use a "Git Clone" like a branch? I get the feeling not, but I am totally new to Git so I will ask (since do not see answer elsewhere). What I mean, is if I do a "Git Clone", work on that source code for a while, do another "Git Clone" of same source folder to different destination, work on that and subsequently can I commit / push both destination folders of code successfully? Both of these folders have the same source folder, just done with "Git Clone" at different times. In other words, is TortoiseGit smart enough to figure out the merging, etc.?

Thanks,

Buck

Was it helpful?

Solution

You can do that, although I think you would have to pull first, merge locally and then push the changes in order to merge them. But you can also use actual branching, which is similar.

Advantage of 'real' branching is that you don't have to have two complete clones (in addition to some additional advantages depending on how you use it).

The disadvantage is that you have to toggle between branches if you want to switch working on them, so you cannot work on two branches on the same clone at the same time. Also, any uncommitted changes also shift to the other branch, unless they collide with changes made there, in which case you have to stash those changes. Anyway, a 'quick' toggle to a different branch isn't as easy as you'd hope.

OTHER TIPS

You can, but it hardly makes sense. git already has excellent support for branches without copying the whole repository (as some other version control systems do). I suggest you learn how to use native git branches, otherwise cooperation with other developers will be hard. (And yes, both with separate repositories as created by cloning, and with true branches, you can still merge.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top