newly created - by creating a folder & running the command git init
in short creating a local git repo from the top.
I have here a local git repository (newly created) with 2 branches. Now these branches are just dummy ones which I created, nothing much important to it.
$ git branch
* repo2-branch1
repo2-branch2
I also have here a remote repository (private) from Github with a branch "TLA1", now remember the newly created local repository I mentioned above with those 2 branches? What I wanted to do is to ADD this "TLA1" branch as one of the branches with repo2-branch1
& repo2-branch2
in my newly created local repository as I mentioned.
Let's say the "TLA1" branch has been added. So when I type git branch
I would like to have it like this.
$ git branch
* repo2-branch1
repo2-branch2
TLA1
Of course when I type git log
when I switch to "TLA1" I would also have the commits which is in the remote repository as you can see in the image, cause for me those commits are very important.
Solutions I have tried:
I have done many research and found this, I thought this was already it as it was similar to my goal. But when I tried it I get an error.
$ git checkout -b TLA1 origin/TLA1
fatal: 'origin/TLA1' is not a commit and a branch 'TLA1' cannot be created from it
I also have not tried this as this thing might do something to my remote repo git reset --hard <remote>/<branch_name>
& it seems to be not the solution I am finding.
Any solutions to this? I'd really like to have this branch on my newly created repository.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…