You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
986 B

---
title: Keep up-to-date on forked repositories
aliases: /posts/2020-11-14-keep-up-to-date-on-forked-repositories
categories: [computerstuff]
tags: [git]
date: 2020-11-14T23:20:16+01:00
---
I usually fetch the upstream repository and merge it into my local repository,
then upload all the merges into the github repository. That works sometimes,
but it also fails sometimes with me having an extra commit with merges leaving
the git history different from the upstream...
<!--more-->
This snippet has been taken from [github.community][1].
[1]: https://github.community/t/update-a-forked-repository-when-the-original-repository-is-updated/1855/3
```console
$ git checkout master # Make sure you always run the following commands from the master branch
$ git fetch --all
$ git pull --rebase upstream master
$ git push origin master
```
> This will rebase the upstream changes on your local forked version so the
> master branch git history will look exactly the same at the end.