Can anyone else explain checking remote branches using git?

I reviewed a few questions here, especially this one , but I'm still confused.

I have a server configured with a slow uplink through which I am accessing through an SSH tunnel. On this, I cloned the bare Linux kernel repository (starting points point to kernel.org). Then I cloned the bare repository on my home machine, checked the tag, created a branch (for example, β€œtest”), made changes to this branch and finally pushed the changes to the bare repo on my server.

Now I'm on the client site and I want to check the branch. To avoid my slow uplink on the client site, I cloned the linux repo from kernel.org and changed the "origin" to point to my server through the SSH tunnel. I see a branch, but cannot verify it :

~/linux-3.0.y$ git version git version 1.7.0.4 ~/linux-3.0.y$ ~/linux-3.0.y$ git status # On branch master nothing to commit (working directory clean) ~/linux-3.0.y$ ~/linux-3-0.y$ git remote show origin git-user@localhost password: * remote origin Fetch URL: git+ssh:// git-user@localhost :48884/home/git-user/linux-3.0.y Push URL: git+ssh:// git-user@localhost :48884/home/git-user/linux-3.0.y HEAD branch: master Remote branches: test new (next fetch will store in remotes/origin) master new (next fetch will store in remotes/origin) Local ref configured for 'git push': master pushes to master (up to date) ~/linux-3.0.y$ ~/linux-3.0.y$ git checkout -b test origin/test fatal: git checkout: updating paths is incompatible with switching branches. Did you intend to checkout 'origin/test' which can not be resolved as commit? 

What I really intended was to work with a branch set up at home on my client site. What should I do (did) to check this thread?

+6
source share
1 answer

Well, firstly, it seems that you have not received the branches.

Use git branch -a instead of git remote show origin .

If the test branch is missing, do git fetch --all .

Now, if you want to check the remote branch as a local branch with the same name, just do git checkout BRANCH_NAME , it will be automatically configured to track the origin.

+11
source

Source: https://habr.com/ru/post/896798/


All Articles