Answer the question
In order to leave comments, you need to log in
How to link git branches?
I connect via ssh to the server. I want to pull a branch from the repository to the server so that they are connected. I can create a new branch on the server with the same name as in the repository, and spool everything from origin/branch into it, but they don't get linked as I understand it. How to do it?
Answer the question
In order to leave comments, you need to log in
And to link branches, use the following command
git branch --set-upstream-to=<внешний-репозиторий>/<внешняя-ветка> <локальная-ветка>
git clone <URL>
git branch feature # создать пустую ветку с именем feature
git switch feature # переключиться в эту новую ветку
# но свежесозданная ветка не связана ни с какой внешней, поэтому следующей командой
# придётся указать откуда и что скачивать
git pull origin feature # влить внешнюю ветку origin/feature в текущую локальную ветку
# но проще ветки сначала связать
git branch --set-upstream-to=origin/feature feature
# и тогда заработает простой pull
git pull
git switch origin/feature
git pull
, you will see that everything is connected and downloaded from where it is necessary. git clone --branch feature <URL>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question