S
S
Searcher82021-09-11 14:22:00
git
Searcher8, 2021-09-11 14:22:00

How to connect to one of the branches of a remote repository?

There is a repository in which I need to complete a task. It's not mine, it was created by another programmer who gave me access to it in order to finalize one code there.
The bottom line is that the code I have to work on is on one of the branches of the repository. Those. there is a main branch and a mainpage branch. I need the mainpage branch.
When using the git clone <link> command, I download files from the main branch.
I'm just starting to learn git, so in order not to do business with someone else's code, I ask you to write a step-by-step instruction in the answer on how I can connect to the mainpage branch and get files from there in order to work in it in the future.
I ask you not to give answers with links to the git documentation, because I already tried to find an answer on it, but I haven’t fully figured it out yet, but I need to do it faster, which is why I’m contacting through Habr.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Searcher8, 2021-09-11
@searcher8

Okay folks, I've found the answer by trial and error.
I do not know how true he is, but he completed the task.
The command helped: git pull origin mainpage , where mainpage is the branch from which I needed files.
P.s. thanks to those who really tried to help me with their answers.

A
Alexander Karabanov, 2021-09-11
@karabanov

git clone -b mybranch --single-branch <link>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question