Well, I am new to this forking and pull requests. Usually when we are on git and fixing some issues then we mostly use this. But somehow when the main repo is ahead then you need to merge the changes to your repo as well. So these commands will be very helpful also.

So, let's get started.

Step 1:  Make sure that you're on your master branch.

git checkout master

 

Step 2: Add the remote of the original repo and call it "upstream".

git remote add upstream https://github.com/name/repo-name.git

 

Step 3: Now fetch your upstream.

git fetch upstream

 

Step 4: 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

 

Step 5: Now push your fork master branch.

git push origin master

Last Modified: 2 months ago