Reputation: 14036
Suppose, I've repo - https://server/tests/ui and when I forked it, it has two branches - master
and release
.
Suppose after few days, someone adds new branch say feature
to upstream. If I want to take that new branch into my fork, which git commands should I use?
Upvotes: 1
Views: 2602
Reputation: 556
you do a git fetch
then
if you have only one remote let's say origin you do
git checkout feature
if you have multiple remotes
git checkout -b feature remote_name/feature
Upvotes: 1
Reputation: 452
Best way to do it would be to first fetch the new branch from upstream into your cloned local repo and then push it to origin.
Below are the git commands:
git fetch upstream
Above command will fetch the new upstream branch.
git checkout -b feature upstream/feature
This will create a local branch with the name feature.
git push -u origin feature
This will push the new branch to the origin and will start tracking it(keeping the branch name same on origin).
Hope this helps you!!
Upvotes: 4