• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

Git: Keeping A Fork In-sync With The Source Repository

Git · September 8, 2020

You fork a repository on somewhere like GitHub or GitLab and you make some changes. Maybe you want to contribute to an open-source repository. You work on your fork, but in the interim, the repository you forked has had a new release and quite a few new commits.

How do you get those commits from the repository you forked and merge them into your fork? This is where setting an upstream from the forked repository comes in handy.

1. Add an upstream remote

First thing you should do after forking a repository, is adding the source as an upstream remote.

git remote add upstream git@github.com:aurelia/aurelia.git

2. Keep the upstream up-to-date

This will fetch changes from our upstream (the parent repository that we forked from) — if there are any new changes, it will update our upstream.

git fetch upstream

3. Then to update your current repository, you can fetch and rebase

The reason you should use rebase is if you have some local changes, your commit history will be kept clean. If you have ever pulled and merged changes in without rebasing, then you might have seen how messy your history can get.

git rebase upstream/master

Dwayne

Leave a Reply Cancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular

  • Testing Event Listeners In Jest (Without Using A Library)
  • How To Get The Hash of A File In Node.js
  • Which Neural DSP Archetype Plugins Should You Buy?
  • Smoke Detector Randomly Goes Off Early Hours of The Morning
  • Neural DSP Reveal Details About the Long-Awaited Quad Cortex Desktop Editor
  • How To Mock uuid In Jest
  • Web 3.0 may have died before it even started
  • Deno Raises $21M - but is anyone using it yet?
  • How To Decompile And Compile Android APK's On A Mac Using Apktool
  • NBN Box Installed Inside of Garage, Where Do You Put The Modem?

Recent Comments

  • Jay on Neural DSP Reveal Details About the Long-Awaited Quad Cortex Desktop Editor
  • john on Deno Raises $21M – but is anyone using it yet?
  • Oranges on How To Store Users In Firestore Using Firebase Authentication
  • Precious on Fixing Sequel Pro SQL Encoding Error For Imported SQL Files
  • James on A List of WordPress Gutenberg Core Blocks

Copyright © 2022 · Dwayne Charrington · Log in

wpDiscuz