Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
155882 stories
·
33 followers

What are git worktrees, and why should I use them?

1 Share

It seems like the latest hotness in git these days is the concept of worktrees. Which… is kind of funny because they’ve been around since 2015.

But, nevertheless, they are cool, and you might be wondering why you’d use them, how they differ from branches, and why they are suddenly so popular.

Let’s talk about it!

Context switching with branches and stashing

Let’s say you lived in a worktree-less world, and were working on a ticket, and suddenly an urgent bug came to you and you had to switch contexts.

First, you might stash your work:

git stash "wip feature login" 

Then you’d switch to your main branch and update:

git checkout main 
git pull origin main

Then make a bugfix branch:

git checkout -b hotfix-bug

Then you’d fix everything, commit, and push the branch:

git add . 
git commit -m "fix broken submit button" 
git push origin hotfix-bug

Then after merging a pull request, you might return back to your computer and pull main and remove the bug branch:

git checkout main 
git pull origin main 
git branch -d hotfix-bug 

And then you could go back to the feature you were working on:

git checkout feature-login 
git stash pop

Phew. Where were we?

The mental overhead of switching around, reloading files, reinstalling node_modules based on whatever changed, and so on, is a lot. The context switching burden is heavy.

Now, this is a basic example, but sometimes developers would work around this kind of chaos with doing some more complicated git stash commands, or even multiple clones of the same repo (I’m guilty of that one).

Until… worktrees!

Context switching with worktrees

With worktrees, you never leave your branch and you never stash, and your editor context for your original feature stays untouched.

git worktree add ../hotfix-workspace -b hotfix-bug main

This instantly creates a sibling folder called hotfix-workspace, and bases it on main, and checks out a new branch called hotfix-bug.

Now you can open that folder in a new editor window (or cd into it) and fix the bug. Your original editor window stays exactly as you left it.

cd ../hotfix-workspace 
# ...fix fix fix... 
git add . 
git commit -m "fix broken submit button" 
git push origin hotfix-bug

You merge the pull request online just like before, and once it’s merged, you can simply delete the temporary folder.

cd ../main-project 
git worktree remove ../hotfix-workspace

This is so much smoother! There’s zero risk of stash conflicts, there’s no editor disruption, and you can truly work in parallel.

So… why now?

For a really long time, worktrees were relatively unknown. Most developers had never heard of them, because either Git GUIs didn’t support them (or treated them as second-class citizens), or because they just usually followed the known pattern of feature branch, then work, then PR, then merge, then repeat.

Now, our work as developers has changed. AI has made us work in parallel more than we ever have before in the history of software development. Developers run so many sessions in parallel, and “code review culture” is growing beyond “code writing culture.”

Agents and humans can do more in parallel with worktrees. It’s the default mode for the GitHub Copilot app, and for many other modern tools.

What’s the catch?

Worktrees do solve a whole lot of issues, but there’s definitely some things to watch out for.

  • Dependency bloat: each worktree folder requires its own copy of your project dependencies. If you’re running npm install or pip install across multiple of them, your computer might get very full, very quickly.
  • Folder management: you have to delete the worktree folders, to avoid cluttering your parent directory over time. Apps like the GitHub Copilot app do often handle this for you, but it’s still something you might have to do yourself if you’re operating in the terminal yourself.
  • Global .gitignore requirements: if you create worktree folders inside your main repo directory, you have to manually add them to .gitignore to not accidentally track them. You can make these worktrees outside of your main repo (and many apps do that by default), but it’s worth noting.
  • One branch limits: Git prevents you from checking out the exact same branch in two different worktrees at the same time to prevent data corruption.

How do I use worktrees in the GitHub Copilot app?

Great question! What’s awesome is… they “just work” out of the box. When you open the app, there’s a dropdown that asks you where you want to run your new session on the home screen. The default is a new worktree.

Screenshot of the 'New worktree' dropdown in the GitHub Copilot app. Options are 'New worktree', 'Local repository', or 'Cloud.'

Then, once you kick off a new session, you can click the session name at the top of the app, and you’ll see the (fun!) generated name of your worktree, as well as the bath where it’s located, the project that worktree is for, and details about the changes that you’ve made.

Screenshot of the worktree generated in the previous step.

Easy peasy lemon squeezy!

Should I use worktrees?

I will give you the most senior developer answer I can: It depends! You might prefer working in one way or another. You might not do as much work in parallel and like the mental model of branches and stashing. You might only do worktrees from now on. You might want to do both!

The world’s your oyster, and you can try them all in the GitHub Copilot app today.

The post What are git worktrees, and why should I use them? appeared first on The GitHub Blog.

Read the whole story
alvinashcraft
25 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Achieving success with AI

1 Share

The two most important elements in any AI solution are Intelligence + Trust. I first made this statement in November at our Ignite conference and my conviction is strengthened by every conversation I have with customers. Through my travels, three consistent topics are being raised when considering the adoption of AI solutions:

  1. Will AI amplify the intelligence of my organization and the attributes that make my company unique within its industry to grow my business; or will it use my intelligence for its own benefit, learning from my most important business flows and leveraging my intellectual property?
  2. Can I trust that the outcomes are providing durable return on investment and that these solutions are running within the confines of my governance and security standards?
  3. How do I get the visibility, control, flexibility and business model innovation needed to manage the costs associated with AI and maximize value?

I consistently advise customers that they need to build their own IQ on a platform of intelligence that is model-diverse, open and heterogeneous at every layer of the stack. Models are commoditizing. No company should be dependent upon any one model or any one model’s harness. Over the weekend, Satya warned of a world where every company across every sector is ceding value to a few models that eat everything they see. AI that is intended for growth should amplify the intelligence of an organization so that it compounds from within.

Companies also need an observability platform that provides governance, management, security and Financial Operations (FinOps) to ensure the ROI with AI. This enables AI to be trusted within the environment over which it reasons and puts the business in control of the outcomes.

Intelligence + Trust is embedded across Microsoft 365 Copilot, GitHub Copilot and Copilot Studio, where model diversity aligns cost and performance to each task. Microsoft IQ optimizes workflows, so context is routed efficiently and reduces unnecessary compute. Agent 365 is the control plane to observe, govern, manage and secure agents. We have built a system to manage AI spend as a core enterprise capability, not an afterthought. It is delivered across clouds and model providers without locking customers into a single approach.

Managing costs at scale

As agent usage scales, organizations need a clear set of levers to manage cost:

Model diversity. Any given inferencing model, model harness or agentic loop on its own does not help build out an organization’s IQ in ways that compound its intelligence. Both Microsoft 365 Copilot and GitHub Copilot are model-diverse by design without locking customers into a single provider. Different models — like GPT-5.5 or Claude Opus 4.8 — serve distinct roles with different economics. Matching the right intelligence to each task optimizes performance and cost.

Your IQ. Agents struggle with raw data. Significant compute is spent interpreting structure and context before useful work begins. The Microsoft IQ platform empowers your IQ by turning raw data into usable intelligence, continuously building a semantic understanding of how your organization operates across Microsoft 365 and line-of-business systems. It provides agents with the context they need upfront rather than requiring them to reconstruct it. The result is measurable: faster execution, higher accuracy and lower token usage. This is how intelligence compounds within your organization.

Financial operations. FinOps became critical when companies moved to the cloud and requires even greater attention as AI shifts from fixed pricing to usage-driven models. With Foundry and Agent 365, we are providing tools to help our customers optimize their AI costs today.

Frontier business models

Business models are evolving as we use AI to drive business outcomes. The User Subscription License (USL) has become the foundation, providing a package of capabilities for a predictable per-user-per-month fee. Usage-based licensing has emerged for long-running, multi-tasking agents, where cost aligns directly to the work performed.

Microsoft gives customers a unique combination of business model flexibility and integrated product experiences that is unmatched in the market. Microsoft 365 Copilot and GitHub Copilot use both models — a USL offering with not only value and capabilities, but flexible consumption on top. Today we’re announcing the general availability of Copilot Cowork worldwide, which requires the Microsoft 365 Copilot USL and is then usage-based.

Our model-diverse strategy allows customers to purchase capacity with the flexibility to use the right model for the job based on model strengths, economics and the latest innovations. Microsoft Agent Factory provides a single consumption model spanning Microsoft 365 Copilot (including Cowork), GitHub Copilot and agents built in Fabric, Foundry and Copilot Studio.

Our integrated product experiences put AI in the flow of work for both knowledge workers and software developers and manage capacity fluidly across the two. Historically these personas have been distinct, but increasingly the line between them is blurring. Coding is becoming a mainstream knowledge worker skill and chat and Cowork are becoming modalities important for software development. With Microsoft 365 and GitHub, we offer market-leading tools for both roles and make it easy to seamlessly manage capacity based on availability and need.

Agent 365: The control plane

As organizations adopt agents from Microsoft, another provider or build their own, a control plane is essential. Agent 365 gives IT and security leaders a single place to observe, govern, manage and secure agents across the organization. It builds on the Microsoft stack that enterprises trust: Entra for identity, Defender for threat protection, Purview for data governance and Intune for endpoint management. We are extending Agent 365 to include cost management, so organizations can monitor and manage agent spend alongside security and compliance. As the Frontier Firm operating model takes hold, leaders will manage human and agentic work as a single system, with visibility into both performance and cost.

The two most essential elements in any AI solution are Intelligence + Trust. At Microsoft, this conviction shapes how we design every layer of our AI platform. Microsoft IQ enables organizations to harness their own unique IQ, bringing context to data and embedding AI directly into the flow of work to deliver faster, more accurate and more trusted outcomes while safeguarding assets and protecting intellectual property. Agent 365 provides that trust layer, ensuring every agent and AI artifact is observed across the environment so organizations can move decisively from experimentation to enterprise impact with confidence. As Jay Parikh put it at Build, AI alone will not change your business. The system running it will.

We have built this system for our customers and partners, where intelligence compounds from within and every agent operates with control, visibility and trust. Together, we can scale human ambition and define how AI delivers measurable business impact across every role, organization and industry.

Judson Althoff is the chief executive officer of the commercial business at Microsoft. He is responsible for the product strategy, sales, services, support, marketing, operations and revenue growth of the company’s commercial business, which operates in more than 120 regional and national subsidiaries globally.

The post Achieving success with AI appeared first on The Official Microsoft Blog.

Read the whole story
alvinashcraft
26 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

MBW 1029: Intimate Functionalities - Is the New Siri AI Good?

1 Share

John Gruber of Daring Fireball joins the MacBreak Weekly panel this week! A deep dive into Apple's new Siri following WWDC. Why Apple Intelligence & the new Siri is not coming to the EU initially later this year. And could the iPhone Ultra's launch be delayed this year?

  • Private Cloud Compute Severely Limited for Third Party Devs.
  • The future of Siri, or: why private inference isn't private enough.
  • I tried Siri AI, and so far it actually works.
  • How much Gemini is really inside Siri AI?
  • The EU's DMA Folly.
  • Reports of iPhone Ultra launch delays are 'false,' says leaker.
  • Apple Vision Pro helped Disney re-engineer a classic EPCOT ride.
  • Under-16 social media ban announced by UK government.
  • Fox to Buy Roku Streaming Service in $25 Billion Deal.

Picks of the Week

  • Andy's Pick: Google Earth Flight Simulator for the Web
  • John's Pick: Hovercraft
  • Christina's Pick: Parachute Backup

Hosts: Leo Laporte, Andy Ihnatko, and Christina Warren

Guest: John Gruber

Download or subscribe to MacBreak Weekly at https://twit.tv/shows/macbreak-weekly.

Join Club TWiT for Ad-Free Podcasts!
Support what you love and get ad-free audio and video feeds, a members-only Discord, and exclusive content. Join today: https://twit.tv/clubtwit

Sponsors:





Download audio: https://pdst.fm/e/pscrb.fm/rss/p/mgln.ai/e/294/cdn.twit.tv/megaphone/mbw_1029/ARML3284320846.mp3
Read the whole story
alvinashcraft
26 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Cloud-Native Data Without Starting Over

1 Share
From: dotnet
Duration: 30:48
Views: 59

Modernizing your application does not have to mean rebuilding it. Many line-of-business applications are tightly connected to their data, making cloud migration feel risky, expensive, and disruptive. But what if the database could move first? This session explores practical patterns for incremental migration without the rewrite or architectural chaos. This is not a "lift and pray" migration, nor a bunch of compromises and workarounds. With stable API layers, modern data access patterns, and new tooling, we will demonstrate how applications can evolve through strategies designed for real systems, real budgets, and real engineering teams.

Connect with .NET:
Blog: https://aka.ms/dotnet/blog
Twitter: https://aka.ms/dotnet/twitter
TikTok: https://aka.ms/dotnet/tiktok
Mastodon: https://aka.ms/dotnet/mastodon
LinkedIn: https://aka.ms/dotnet/linkedin
Facebook: https://aka.ms/dotnet/facebook
Docs: https://learn.microsoft.com/dotnet
Forums: https://aka.ms/dotnet/forums
🙋‍♀️Q&A: https://aka.ms/dotnet-qa
👨‍🎓Microsoft Learn: https://aka.ms/learndotnet

#dotnet

Read the whole story
alvinashcraft
27 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Cold Case or Active Asset? A 2005 WinForms LoB Application

1 Share
From: dotnet
Duration: 31:43
Views: 99

Read the whole story
alvinashcraft
27 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Modernize .NET Apps and Add Agentic Functionality in Minutes

1 Share
From: dotnet
Duration: 28:29
Views: 125

Read the whole story
alvinashcraft
27 minutes ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories