M
M
Maxim Rybalkin2019-12-11 11:37:49
git
Maxim Rybalkin, 2019-12-11 11:37:49

How to pull from a branch of someone else's project in GIT?

Two people have the same study project. The branches are also the same, let them be master and HW09. How can I copy files from his HW09 branch to my HW09 so that master and other branches are not affected?
Regular git clone is not suitable; there are many other branches - and they cannot be changed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-12-11
@MaxRybalkin

How can I copy files from his HW09 branch to my HW09 so that master and other branches are not affected?

If there is an HW09 branch in the local repository, then like this:
git fetch <URL чужого репозитория> HW09
git checkout HW09
git reset --hard FETCH_HEAD

if not, then like this:
git fetch <URL чужого репозитория> HW09
git checkout -b HW09 FETCH_HEAD

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question