Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...