Home > Mobile >  Does .gitattributes need to be on every branch?
Does .gitattributes need to be on every branch?

Time:10-08

As a repo creator/admin I want to ensure that people working on both Windows and Linux won't have problems with line endings (CRLF vs LF). I've read that .gitattributes is a good way to do that. I've also read that I need to commit to my repo just like any other file at its root.

But since it's apparently just like any other file do I need to commit it to every branch? Do I need to watch out for this while creating branches (and possibly some other actions)?

I've really tried googling for that but just couldn't find anything.

CodePudding user response:

Yes, just like .gitignore it will only be effective when it's checked out.

Meaning if you check out a branch that doesn't have it then it won't do anything.

But usually that's solved by merging it into main or master and all other branches will eventually fork from there. If you have any other long-running branches (such as a maintenance branch for an older version), then you can decide to cherry-pick it onto there as well.

  • Related