Microsoft has agreed to buy code-sharing site GitHub for $7.5 billion.

More than 28 million developers from 1.5m companies collaborate on the online platform, which is used by many tech giants, including Microsoft.

The deal, for Microsoft stock, will go through this year.

“Microsoft is a developer-first company, and by joining forces with GitHub we strengthen our commitment to developer freedom, openness and innovation,” said Microsoft CEO Satya Nadella.

“We recognise the community responsibility we take on with this agreement and will do our best work to empower every developer to build, innovate and solve the world’s most pressing challenges.”

Microsoft said GitHub will continue to operate independently and that developers will continue to be able to use it to deploy code “to any operating system, any cloud and any device”.

Microsoft Corporate VP Nat Friedman, founder of Xamarin and an open-source veteran, will become to CEO of GitHub CEO.

Current CEO Chris Wanstrath will become a Microsoft technical fellow and work on strategic software initiatives.

“I’m extremely proud of what GitHub and our community have accomplished over the past decade, and I can’t wait to see what lies ahead,” said Wanstrath.

“The future of software development is bright, and I’m thrilled to be joining forces with Microsoft to help make it a reality.

“Their focus on developers lines up perfectly with our own, and their scale, tools and global cloud will play a huge role in making GitHub even more valuable for developers everywhere.”

Github was last valued in 2015 at $2bn.