Scott
Scott

Reputation: 1222

I forked up my commit history?

I'm relatively new to git so I'm sure I didn't handle this correctly.

Instead of forking off a repository from Github I just pulled from it and then reset my remote origin to a private repo on my own account. I used new branches to create features or fix some bugs sometimes but not consistently.

This was about a month ago and the changes I made are not wanted in the original repo but there are some changes I want to pull from the master branch.

Having my background details, how would I go about pulling those changes without screwing up my commit history? I've read some about merging and rebasing but I really only have practice merging from branches on the same repo locally.

Upvotes: 0

Views: 50

Answers (1)

avigil
avigil

Reputation: 2246

Add the original repo as a remote (see documentation on github)

git remote add upstream https://github.com/user/repo.git

Then you can do things like rebase off upstream/master (if you want to match the history of the upstream branch) or merge (if you don't care about diverging from the upstream project commit history). Something like

git fetch --all
git merge upstream/master # or git rebase upstream/master

Upvotes: 3

Related Questions