1

We just converted a Subversion repository to a Git repository using Atlassian Stash's Import Subversion tool. For the most part is seems to have worked though the .gitattributes it generated seem to leave much to be desired.

It created a file with 7503 entries all with their text diffs unset, even for text files. This shear number of entries was a result of each file being explicitly listed rather than using pattern matching.

To fix this I created a local non-tracking branch off of master called add-gitattributes. Within here I modified the default .gitattributes file so it looks like this: https://gist.github.com/anonymous/6049144 and committed the changes to add-gitattributes.

I am now in the process of going through the process of normalizing line endings in our repository as described in how-to-normalize-working-tree-line-endings-in-git. A lot of files (5000+) are modified according git status, as expected.

However, branched from master are a dozen or so branches, some branches have branches. How do I normalize the line endings of all of these branches? Can I just merge my git-attributes branch into master and update (merge) the other branches? What about new files that were added in the other branches, how do they get normalized? How would I address conflicts if there were any?

Community
  • 1
  • 1
Ryan Taylor
  • 8,740
  • 15
  • 65
  • 98
  • You'll want to initiate a pull request with your latest code, onto each branch that you want to bring in your line ending changes. When they accept the pull request they'll handle any conflicts that arise at that time. It also gives you an opportunity to explain exactly why you want the other branches to merge in your changes. – Derek Jul 22 '13 at 02:12
  • Could you better explain what you mean by normalize in your context. Git totally has the formatting you need, I'm just not yet 100% sure what you mean. – usumoio Jul 22 '13 at 03:12

1 Answers1

0

You'll want to initiate a pull request with your latest code, onto each branch that you want to bring in your line ending changes.

1.) Commit and push your changes to master

2.) Initiate a pull request from master to each branch that you want to make sure has these changes. At this time you will have an opportunity to explain exactly why you want the other branches to merge in your changes.

3.) When they accept the pull request they'll handle any conflicts that arise at that time.

As for new files, you'll have to give instructions to your dev team to only use the line endings that you want to keep. Most IDEs can be configured to use whichever one you want by default when creating or modifying files.

Derek
  • 4,575
  • 3
  • 22
  • 36