Skip to content

Latest commit

 

History

History
68 lines (43 loc) · 2.51 KB

forked repo instruction.md

File metadata and controls

68 lines (43 loc) · 2.51 KB

work with a forked repository

from stackoverflow

with GitHub Online (dirty)

stackoverflow-answer

  1. Open your fork on GitHub.
  2. Click on Pull Requests.
  3. Click on New Pull Request. By default, GitHub will compare the original with your fork, and there shouldn't be anything to compare if you didn't make any changes.
  4. Click switching the base if you see that link. Otherwise, manually set the base fork drop down to your fork, and the head fork to the upstream. Now GitHub will compare your fork with the original, and you should see all the latest changes.
  5. Create pull request and assign a predictable name to your pull request (e.g., Update from original).
  6. Scroll down to Merge pull request, but don't click anything yet.

Now you have three options, but each will lead to a less-than-clean commit history.

  1. The default will create an ugly merge commit.
  2. If you click the dropdown and choose Squash and merge, all intervening commits will be squashed into one. This is most often something you don't want.
  3. If you click Rebase and merge, all commits will be made "with" you, the original PRs will link to your PR, and GitHub will display This branch is X commits ahead, Y commits behind <original fork>.

So yes, you can keep your repo updated with its upstream using the GitHub web UI, but doing so will sully your commit history.

with git commands (clean)

stackoverflow-answer

Add remote

Add the remote, call it "upstream"

git remote add upstream https://github.com/notenverwaltung/Notenverwaltungssoftware.git

Fetch

Fetch all the branches of that remote into remote-tracking branches

git fetch upstream

checkout

Make sure that you're on your master branch

git checkout master

rebase

Rewrite your master branch so that any commits of yours that aren't already in upstream/master are replayed on top of that other branch

git rebase upstream/master

push

If you've rebased your branch onto upstream/master you may need to force the push in order to push it to your own forked repository on GitHub. You'd do that with:

You only need to use the -f the first time after you've rebased.

git push -f origin master