简体   繁体   中英

.NET Git ignore whitespace

I am using .NET, Visual Studio 2010 and Git in my development at work. I am looking for a way to make git ignore the white spaces due to different coding styles between our team.

For readability, some of my colleagues really need to have some white spaces while others don't.

For example, some of us write code as:

var b = new B();

While others, write it as:

var b = new B( );

Since git doesn't understand those white spaces, it threats them as changes. However, that results in some merge conflicts and difficulties to see the actual changes in code. Is it possible to "make" git understand that this white space should be ignored?

Thanks for any ideas!

The correct fix for this would be to make all developers agree up on the same conventions.

And as Jeow Li Huan points out, you can use StyleCop to enforce people actually comply to these conventions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM