0

Let us define "upstream" as an apache repo for which a remote was created:

git remote add upstream https://github.com/apache/spark.git

We have a forked repo in which we are creating new files - presently should not need to do merge's with upstream.

We did however unintentionally commit/push a common file to our repo:

pom.xml

Now the problem is that every time that we want to rebase to upstream via:

git rebase upstream/master

We then have merge conflicts with the pom.xml.

Our intention is to just completely forget/ignore any of our own repo changes to that file - and just use the latest upstream version . We do not want to have to deal with backing out our changes to that file every time we sync to upstream.

Now, simply doing

git checkout HEAD -- pom.xml 

will not work since that pulls the latest version from our local repo.

Also using

git rebase -i upstream/master

is not clear how would help - since the commit in which pom.xml was included has other changes we do need. We can not simply remove that particular commit

So what are the options here for - as much as possible - completely forgetting our changes to pom.xml. If the git history were not possible to fix, at least we want to avoid needing to do repeated merges of that file every time a merge to upstream is performed.

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • Why are merge conflicts happening, is upstream changing that file as well? When rebasing git replays your changes on top of the selected branch head. If nothing changed it applies just fine. – Nick Zavaritsky Jan 22 '15 at 14:16
  • Upstream has many many changes in that pom.xml file. It is my intention to accept the upstream wholesale: the point of my discourse is how to do so automatically moving forwards. – WestCoastProjects Jan 22 '15 at 14:19
  • Check [this](http://stackoverflow.com/questions/2945344/selecting-merge-strategy-options-for-git-rebase) out. The cleaner way would be probably to remove your changes to pom from the history. Git rebase -i can do it (choose edit, not only can you change commit message in this mode but also integrate arbitrary changes into commit - use git add, git commit -amend) – Nick Zavaritsky Jan 22 '15 at 14:28
  • @NickZavaritsky That link - to "-s recursive -X theirs" is quite interesting – WestCoastProjects Jan 28 '15 at 16:35

0 Answers0