0 votes
1 view
in Devops and Agile by (29.3k points)
edited by

I recently forked a project and applied several fixes. I then created a pull request which was then accepted.

A few days later another change was made by another contributor. So my fork doesn't contain that change.

How can I get that change into my fork? Do I need to delete and re-create my fork when I have further changes to contribute? Or is there an update button?

1 Answer

0 votes
by (50.2k points)

Local clone of a forked repository, you can add the original github repository as a ‘remote’.

Then you can fetch all the branches form that upstream repository

To continue with that upstream version rebase your work let’s see the commands how it look like

git remote add upstream https://github.com/whoever/whatever.git

It will add the main repository to remote

And now fetch all branches to remote tracking branches using 

git fetch upstream

Make sure that you are on the master

git checkout master 

Here you can rewrite your changes, after re-writing rebase the repository

git rebase upstream/master

If you don’t want to rewrite the history then use merging instead of rebasing

git merge upstream/master

Note: it’s better to use rebase to make further pull requests

If you choose to rebase then you need to force push to your forked repository

git rebase -f origin master

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...