2

Trying to figure this out here. Trying to merge the latest linux 3.0 changes (3.0.41) to a kernel project I'm working on based off HTC source (3.0.8). I downloaded the source, committed the base files, added the linux-stable tree as a remote, and tried to merge it with 'git merge linux-stable/linux-3.0.y'. In the response, I am given:

error: Untracked working tree file 'Documentation/DocBook/dvb/dvbstb.pdf' would be overwritten by merge. Aborting

Which is a file in .gitignore. If I git add -f that file, it just errors with the next file in the .gitignore. Is there a way for me go merge this cleanly without these errors? I don't want to do it commit by commit, since there would be thousands of commits to merge.

user1602600
  • 421
  • 1
  • 4
  • 5
  • After you added files to `.gitignore`, did you run `git rm --cached`? – Christopher Aug 16 '12 at 12:33
  • The source actuallly came with a .gitignore. git rm --cached does nothing but bring up some flags. Do you mean git rm . --cached? – user1602600 Aug 16 '12 at 18:57
  • The files themselves. Details here: http://stackoverflow.com/a/4858141/877115 – Christopher Aug 16 '12 at 20:03
  • @Christopher For some reason, every directory in the source has a .gitignore. Not just one. There are 30+ .gitignore files. There must be an easier way. If I remove all of the .gitignore files, I get merge conflicts. – user1602600 Aug 18 '12 at 05:50
  • Is your project a public repo? It'd be useful to see it if it is. – Christopher Aug 18 '12 at 13:25
  • @Christopher https://github.com/dmeadows013/fireball-kernel just stock so far. – user1602600 Aug 18 '12 at 22:43
  • Got it. One other question: Is the branch you're trying to merge public? Would like to test a theory out (as well as some possible resolutions) locally. You just grabbing a branch off the kernel source? Which repo? – Christopher Aug 18 '12 at 22:59

1 Answers1

0

First off, if you can find the HTC source as an existing git repository, you will be much better off. The lack of proper git history in your manually constructed tree is inevitably going to cause conflicts. The HTC source is effectively a branch off vanilla Android, which is (presumably) a branch off vanilla Linux, but without the full history, git can attempt nothing better than an effective two-way merge, since it doesn't have the common ancestor in order to do a proper three-way merge. So unless you are an experienced kernel programmer who can handle these conflicts, I expect you will have great difficulty.

Anyway, if obtaining the full history is not possible, your trees will not have a common root, so you will need to consult How do I join two git repos without a common root, where all modified files are the same?.

Regarding the .gitignore issue, if you have files which are ignored in the 3.0.8 tree but tracked in the 3.0.41 three then it sounds like you have a mismatch between the .gitignore files in each tree, so you should compare them, try to figure out why, and decide what should be tracked and what shouldn't. git blame .gitignore in the 3.0.41 tree might help with this. The 3.0.41 tree will be the more authoritative of the two repositories, since it has complete history and will be internally self-consistent, so you could try transplanting its .gitignore into the 3.0.8 tree before your initial import commit. Also be aware that there could be .gitignore files anywhere in the tree, not just at the top-level (I don't know off-hand if the Linux kernel does this).

Community
  • 1
  • 1
Adam Spiers
  • 17,397
  • 5
  • 46
  • 65