Git and github link issu

first question: is there a primary branch and a secondary branch in
Git? Read the article that master is the main branch, so if you create a new branch at this time, will the other branches be considered sub-branches?

read the article and learned that there seems to be a distinction between primary and secondary, for example, master is the primary branch, and other newly built secondary branches test, then when modifying master, such as add and commint to master, then the secondary branch test will naturally have these files; if you create a new file under the test branch but do not have add and commit, then you still cannot see the new file under the test if you switch to master, right? Only after add and cimmint under the test branch, can you see the newly created file under test only if you switch to master, right?

but the problem now is that the newly created file under the test branch does not have any add or commit. After switching to the master branch, you can still see the new file.
what"s the point of branching in this way? Or is it the git of my computer?

in addition, is it possible for post-established branches to see the content that has been built before, even without add and commit??

second question:
can a local git library clone many other github repositories on the Internet? Give it a try, it"s okay.
this is the branch after I cloned a library on the Internet as follows:

`[root@localhost test]-sharp git branch -a
* dev
  master
  test
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

`
where `master

  test
  remotes/origin/HEAD -> origin/master
  remotes/origin/master`

these are from the library, and I built dev.

question 1.

      master
      test
      remotes/origin/HEAD -> origin/master
      remotes/origin/master

here
remotes/origin/HEAD-> origin/master
remotes/origin/master

what is the difference between the two?

question 2. I create any file under the newly created dev, and you can see it under the master and test branches. Why is this?
didn"t you say you can"t see it until you add,commit it?

question 3. Clone can you clone a folder?
for example, if a project has three A B C projects, can you refer to the folder Clone A?

question 4. Link question:
use:

echo "-sharp test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:Xoodge/test.git  -sharpgit
git push -u origin master
What is the difference between the

statement establishing my own github link and the test being cloned by me?
my own understanding. 1. This github has my SSHkey in it, so I can git remote add origin git@github.com:Xoodge/test.git, right? I can"t git remote add origin git@github.com:Xoodge/test.git without my SSH, right?
2. This way of establishing a connection means that I can update the remote test as long as I am local to add, commit and push, right? But if this is cloned, then I want pull request?.

Apr.13,2021

choose several questions to answer, others do not understand what you mean

Is there a primary branch and a secondary branch in the branch of < H2 > 1Git? < / H2 >

actually, to be exact, it should be called the default branch (Default branch),. The interpretation in github is

.
The default branch is considered the "base" branch in your repository
The default branch when the

git repository is initialized is master.
for local git repositories, if you create a new branch, you can delete the master branch immediately.
for most remote git repositories (github, gitee, etc.), you are not allowed to delete it directly, but you can change the default branch and then delete

. < H2 > 2 the newly created file under the test branch does not have any add or commit. After switching to the master branch, you can still see the new file. < / H2 >

first of all, it is normal to have such an effect.
this is about to introduce the concepts of git repository, workspace, version library (including but not limited to temporary storage areas)
0

the picture is from Liao Xuefeng's official website
your file was still in the workspace before add and commit. When you switch branches at this time, only the files that have been added to the version library are affected, but the files in the workspace are not affected

< H2 > 3 remotes/origin/HEAD-> origin/master < / H2 >

this indicates that the default branch of the remote repository is the master branch

< H2 > 4 Clone can you clone a folder? < / H2 >

there is no such operation in the philosophy of git, and it is highly discouraged.

this is related to the operation mechanism of git distributed warehouse. Svn is centralized storage based on file mode, while Git is distributed storage of file information based on metadata. It will fetch all the information back to the local place every time Clone, which is equivalent to generating a clone version library on your machine, now that you have a complete version library locally.
if only a few subdirectories in clone repository are required, then using sparse clone,git to support, sparse clone from 1.7.0 is only a workaround: first get the object and other metadata information of the entire repository, and then add a file called .git / info/sparse-checkout locally (that is, blacklist, whitelist, support rules, see the following specific operation commands) to control those directories and files of pull (similar to .gitignore files, Are all local concepts), flexible implementation.
< H1 > 5 this statement sets up my own github link, and I use cloning to clone the test. What is the difference between the two < / H1 >

A warehouse like this built by yourself in the local git init needs to add a remote warehouse using git remote add origin. In your words, it is cloned by linking with my own github
, and you bring your cloned remote warehouse address

.
Menu