I setup a git server days ago in the lab. I am trying to create two repositories on the same server with name origin and myprj so to maintain two separate projects. I am following the post pull/push from multiple remote locations and GIT repository layout for server with multiple projects
I create a new repository as
git remote add myprj https://xxx.yyy.zzz/repo.git
and it shows me
git remote
origin
myprj
I create a clone on the local computer and it clones the origin repository and master branch, in which I have two files a.txt and b.txt. But the new repository myprj does not have any file yet.
I am trying to fetch the myprj as
git fetch myprj
I got
From https://xxx.yyy.zzz/repo.git
* [new branch] master -> myprj/master
* [new branch] myprj -> myprj/myprj
But this does not update the local folder. I also try
git pull myprj master
From https://xxx.yyy.zzz/repo.git
* branch master -> FETCH_HEAD
Already up-to-date.
But the local folder is not sync with the remote myprj repository. I think I must misunderstand the concepts on repository. I am learning how to easily switch between different repositories on the same server so I can maintain it locally and upload to the remote server later.
p.s. I clone origin/master to the local folder which .git created by git client. In the local folder, I create A.txt and then
git checkout -b origin/master
git add A.txt
git commit -a -m 'this is on origin master'
then I create B.txt for myprj only
git checkout -b myprj/master
git add B.txt
git commit -a -m 'this is on myprj master'
What I expect is after I checkout different repository, should I see the local file changed to refect which files contained in the repository by the client? I found that if I create branch on the same repository, switching between different branch will see the different contents.