git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: merging .gitignore

From
APAndy Parkins <andyparkins@gmail.com>
Date
Oct 1, 2007, 13:48 UTC
Message-ID
<200710011448.17701.andyparkins@gmail.com>
In-Reply-To
<20071001130314.GA5932@lapse.madduck.net>
On Monday 2007 October 01, martin f krafft wrote:
Show 7 quoted lines
> Feature branch A has a .gitignore file, and it's been merged into
> master for a while. Today, feature branch B failed to merge into
> master because it also provides a .gitignore file. We can obviously
> resolve the conflict, but I wonder whether there is a better way to
> deal with this since we deal with quite a large number of new
> feature branches and it's only a matter of time until the next one
> will conflict because of .gitignore.

But it _is_ a conflict. Conflicts have to be resolved. I'm having difficulty understanding what you think git should be doing in these cases?

> (and yes, this is basically a reincarnation of my case for
> .gitignore.d [http://lists.zerezo.com/git/msg627581.html]).

I don't see that that would help. All you are doing with a gitignore.d is swapping lines for files, the conflicts would still exist. Presumably you are hoping that the separate branches will make different files in gitignore.d and hence can't conflict; but then you've just pushed the conflict to a place where it won't be seen (and also made a terrible mess of the merged branch gitignore.d).

 branchA:.gitignore.d/branchAignores
 branchB:.gitignore.d/branchBignores
Over time you would get:
 master:.gitignore.d/branchAignores
 master:.gitignore.d/branchBignores
 master:.gitignore.d/branchCignores
 master:.gitignore.d/branchDignores
 master:.gitignore.d/branchEignores
 master:.gitignore.d/branchFignores

Then, assuming the conflicts you get now occur for a reason, you will get conflicts within the .gitignore.d/ directory. Let's say branchCignores adds *.o and branchFignores removes *.o from the ignores. Who is right? Who knows, and worse than that you didn't see the conflict when it happened so it wasn't resolved and the master branch was left with conflicts in it.

Of course the conflicts in that case aren't in the form of "<<<<<" markers, but they are no less conflicts just because they're invisible.

Eventually someone is going to want to combine this ever-increasing set of ignore files into one. i.e. they'll merge them. In which case why couldn't you do the merge at the correct time - when the branch was merged?

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: martin f krafftNext: Johannes Schindelin
Message 2 of 20 in “merging .gitignore”
  1. martin f krafftOct 1, 2007
  2. Andy ParkinsOct 1, 2007
  3. Johannes SchindelinOct 1, 2007
  4. martin f krafftOct 2, 2007
  5. Junio C HamanoOct 2, 2007
  6. martin f krafftOct 2, 2007
  7. Pierre HabouzitOct 2, 2007
  8. Pierre HabouzitOct 2, 2007
  9. martin f krafftOct 2, 2007
  10. Pierre HabouzitOct 2, 2007
  11. martin f krafftOct 2, 2007
  12. Pierre HabouzitOct 2, 2007
  13. martin f krafftOct 3, 2007
  14. Pierre HabouzitOct 3, 2007
  15. Pierre HabouzitOct 2, 2007
  16. Andy ParkinsOct 3, 2007
  17. Johan HerlandOct 3, 2007
  18. Johannes SchindelinOct 3, 2007
  19. Johan HerlandOct 3, 2007
  20. Junio C HamanoOct 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.