How to pull the latest commits from the main repository into your fork
September 5, 2026
Git usually calls your fork origin.
The original repository is commonly called upstream.
So the basic idea is:
origin → your fork
upstream → original repository
This allows you to fetch changes from the original repository while pushing your own changes to your fork.
Check your current remotes
First, check which remote repositories are configured:
1git remote -v
In my case, I initially had:
12origin https://github.com/likandokayombo/smilefxtraders-fork.git (fetch)origin https://github.com/likandokayombo/smilefxtraders-fork.git (push)
This showed that origin was pointing to my fork. However, there was no upstream remote configured.
Check your current branch
I also checked which branch I was currently working on:
1git branch --show-current
Output:
1changes
This is important because the branch you're currently on is the branch that will receive the changes when you merge upstream/main.
Add the original repository as upstream
Since I knew the URL of the original repository, I added it as an upstream remote:
1git remote add upstream https://github.com/kondwanimuwowo/smilefxtraders.git
Now, running git remote -v outputs:
1234origin https://github.com/likandokayombo/smilefxtraders-fork.git (fetch)origin https://github.com/likandokayombo/smilefxtraders-fork.git (push)upstream https://github.com/kondwanimuwowo/smilefxtraders.git (fetch)upstream https://github.com/kondwanimuwowo/smilefxtraders.git (push)
Now Git knows about both repositories.
Fetch the latest changes from the original repository
Next, fetch the latest commits from the original repository:
1git fetch upstream
This downloads the latest commits from the original repository.
Note:
git fetchdoes not automatically merge those commits into your current branch. It simply updates your local knowledge of the upstream repository.
After fetching, Git will have a reference to the original repository's main branch: upstream/main.
You can check your branches with:
1git branch -a
You should see something similar to:
12345* changesmainremotes/origin/HEAD -> origin/mainremotes/origin/mainremotes/upstream/main
The important part is remotes/upstream/main. That represents the latest main branch from the original repository.
Merge the latest upstream changes
Since I was working on the changes branch, I could now merge the latest changes from the original repository into my branch:
1git merge upstream/main
This tells Git: "Take the latest main branch from the original repository and merge it into my current branch."
If everything goes smoothly, Git will complete the merge. You might see:
12Updating 7b30648..abc1234Fast-forward
Or:
1Merge made by the 'ort' strategy.
At this point, my changes branch contains the latest changes from upstream/main.
What if there are merge conflicts?
Sometimes your branch and the original repository have modified the same lines of code. In that situation, Git may report a conflict:
12CONFLICT (content): Merge conflict in app/page.tsxAutomatic merge failed; fix conflicts and then commit the result.
First, check which files have conflicts:
1git status
Then open the conflicted files. You may see something like:
12345<<<<<<< HEADYour changes=======Changes from upstream>>>>>>> upstream/main
Resolve the conflicts, stage the files, and complete the merge:
12git add .git commit
Push the updated branch to your fork
Once the merge is complete, push your branch to your GitHub fork:
1git push origin changes
Now your fork contains your branch with the latest changes from the original repository.
The complete workflow
You only need to configure upstream once:
1git remote add upstream https://github.com/kondwanimuwowo/smilefxtraders.git
After that, whenever the original repository receives new commits, your daily workflow is simple:
1234git switch changesgit fetch upstreamgit merge upstream/maingit push origin changes
What if I want to update my fork's main branch?
There is a difference between updating your feature branch and updating your fork's main branch.
If you want your fork's main branch to contain the latest changes from the original repository:
1234git switch maingit fetch upstreamgit merge upstream/maingit push origin main
The workflow looks like this:
12345678910111213Original repository|| git fetch upstreamvupstream/main|| git merge upstream/mainvlocal main|| git push origin mainvyour fork's main
Merge vs Rebase
Another option is to use rebase instead of merge:
123git switch changesgit fetch upstreamgit rebase upstream/main
Rebase takes your commits and places them on top of the latest commits from upstream/main.
Before:
123A---B---C upstream/main\D---E changes
After rebase:
1A---B---C---D'---E' changes
This gives you a cleaner, linear Git history. However, be careful when rebasing a branch that has already been pushed and shared with other developers.
For a simple fork workflow, merging is often easier.
Summary
The key concepts to remember:
origin = my fork
upstream = original repository
12345678910111213Original repository (upstream/main)|| git fetch upstreamvLocal repository|| git merge upstream/mainvYour changes branch|| git push origin changesvYour GitHub fork (origin/changes)
For my smilefxtraders setup, every time I want to sync my working branch, I run:
1234git switch changesgit fetch upstreamgit merge upstream/maingit push origin changes
Once upstream is configured, keeping your fork synchronized with the original repository becomes a straightforward Git workflow.