I have forked on github a public repository, created a branch that fixes an issue and submitted a pull request which was accepted. Now I want to update my fork to the latest version of the public repository which has got 100+ commits since then. Since my change was accepted I simply want to fetch the latest repository without merging anything from my own fork. Then I want to create a new feature branch on the latest version to submit further fixes.
I have read several posts e.g.
- https://demisx.github.io/git/rebase/2015/07/02/git-rebase-keep-my-branch-changes.html
- How do I update a GitHub forked repository?
which deal with that issue but that is far away from simple because git wants me to merge every single commit which it cannot automerge. I have changed on my fork one or two files but git wants me to merge hundreds of files on my fork. That cant be right.
I did for my PerfView clone basically
- git clone https://github.com/Alois-xx/perfview.git
- git remote add upstream https://github.com/Microsoft/perfview.git
- git fetch upstream
- git checkout master
- git rebase upstream/master
I then get a warning that I need to merge things one by one for hundreds of files.
C:\Source\git\PerfView_Fork\perfview>git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: Updated HtmlJS directory to contain a stock ASP.NET 5 Service. We can use this to build the back end of the cross platform version of PerfView.
.git/rebase-apply/patch:9414: trailing whitespace.
The basic architecture for the app is there are two processes
.git/rebase-apply/patch:9416: trailing whitespace.
1. One that acts as a 'back end' that acts as a data model.
.git/rebase-apply/patch:9417: trailing whitespace.
This has no user interface and communiates to the UI by
.git/rebase-apply/patch:9419: trailing whitespace.
(that is a REST API) This is responsible for all data.
.git/rebase-apply/patch:9424: trailing whitespace.
2. A second process that
warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.
error: Failed to merge in the changes.
Using index info to reconstruct a base tree...
M src/HtmlJs/documentation/DesignBasics.md
M src/HtmlJs/documentation/DevNotes.md
M src/PerfView/Properties/AssemblyInfo.cs
A src/PerfView/SupportDlls/UsersGuide.htm
Falling back to patching base and 3-way merge...
Auto-merging src/PerfView/Properties/AssemblyInfo.cs
CONFLICT (content): Merge conflict in src/PerfView/Properties/AssemblyInfo.cs
Auto-merging src/HtmlJs/PerfDataService/Views/static/help.html
Patch failed at 0001 Updated HtmlJS directory to contain a stock ASP.NET 5 Service. We can use this to build the back end of the cross platform version of PerfView.
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
I have tried Visual Studio which also follows the git workflow where I have to deal with every single merge error. That should be a common issue to skip merging and simply take the branch as is from the master but I was unable to find a satisfying solution so far.
Why should I even need to merge files which I did never touch on a branch (main) to which I never did any commit at all? That makes no sense to me. The Visual Studio merge dialog shows me
What is Source and Target? I would expect to see as source
https://github.com/Microsoft/perfview.git/master
and Target
https://github.com/Alois-xx/perfview.git/master
That would be helpful to not blindly merge the wrong thing. What is really disturbing me that the merge tool expects me to take a decision for every single file. There seems at least in Visual Studio no option to simple take everything from Source and be done with it.
What is the magic command line looking to do a bulk update of my fork without needing to merge manually hundreds of files?
git merge -Xtheirs ... ?
I have tried to create a pull request for my fork but github also complains about manual merges which are necessary. The easiest thing would be to delete my fork and recreate it but since we have version control there should be an easy way.