Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

How to add upstream/topic_branch to local, forked repo

Solved! Go to Solution.

The following scenario is given:
1) upstream maintainer creates topic branch "ABC_branch"
2) my fork doesn't contain this new branch yet (neither locally nor on GitHub)


How can I add (clone or download, what ever) the new ABC_branch to my local repository without touching my local master or any other existing branch?

2 Replies
Community Manager
Message 2 of 3

Re: How to add upstream/topic_branch to local, forked repo

Hi @max123kl,


Thank you for being here! git rebase in its simplest form is a command which will “port” another branch (Branch A) into the branch where you are currently working (Branch B), by applying all of your unique commits from Branch B on top of Branch A and replacing Branch B with this revised version. That way, you can “catch up” to other branches by re-writing git history in your local git.



Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Community Manager
Message 3 of 3

Re: How to add upstream/topic_branch to local, forked repo

If you have a remote in your local repository named `upstream` that points to their repository and a remote named `origin` that points to your GitHub repository, you can do the following:


# Creates a local branch named `ABC_branch`
git checkout -b ABC_branch

# Fetches the `ABC_branch` content from `upstream` and merges it into your local branch git pull upstream ABC_branch

Then, if you want to have `ABC_branch` in your fork of their repository, you can use:


git push origin ABC_branch

I hope that helps!