• 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

  • I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification
  • Testing Event Listeners In Jest (Without Using A Library)
  • Thoughts on the Flipper Zero
  • How To Get The Hash of A File In Node.js
  • Waiting for an Element to Exist With JavaScript
  • How To Paginate An Array In Javascript
  • Handling Errors with the Fetch API
  • How To Get Last 4 Digits of A Credit Card Number in Javascript
  • Wild Natural Deodorant Review
  • How To Install Eufy Security Cameras Without Drilling or Using Screws

Recent Comments

  • CJ on Microsoft Modern Wireless Headset Review
  • Dwayne on Microsoft Modern Wireless Headset Review
  • CJ on Microsoft Modern Wireless Headset Review
  • john on Microsoft Modern Wireless Headset Review
  • Dwayne on Why You Should Be Using globalThis Instead of Window In Your Javascript Code

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz