Cassidy Williams

Software Engineer in Chicago

Cassidy's face

How to use GitHub Copilot Edits


Did you know that GitHub Copilot can edit files directly? And multiple at once?

It can! And it’s awesome. Copilot Edits is a feature we launched in preview at GitHub Universe this year, and it helps you iterate on changes across multiple files.

Full disclosure: yes I work at GitHub and you can find this in the docs, BUT I wanted to share this tidbit here because I get asked about this feature a lot.

Anyway!

To try it out, open your favorite repo and head over to VS Code. There’s a button in the Copilot Chat window that opens the Copilot Edits view:

Copilot Edits: Start your editing session by defining a set of files that you want to work with. Then ask Copilot for the changes you want to make. The Edits button is in the top left.

From there, you can add any files you’d like to your working set, which are any relevant files you want to work with. Copilot Edits won’t make changes to any files outside of the working set, unless it wants to suggest creating a new file!

The working set of files is at the bottom of the chat window.

And finally, it’s time to ask for what you’d like to change. You can ask for a new component based on existing ones, you can ask to write tests, you can ask it to add certain features, or you could even ask it to fully restyle a page.

Whenever you make a request, you’ll see a full diff of the changes, so you don’t have to accept anything until you’re happy with the results! Iterate on your prompts and hit “Accept” when you’re ready for your changes to be saved. You can save each change one at a time, or all of them at once.

Based on instructions, Copilot Edits made changes, and there's multiple ways to accept them.

And voilà, you’ve edited files with GitHub Copilot Edits, without having to write a line of code for yourself! You can always undo changes or make tweaks, because of course, you’re the developer.

If you want to see this in action, check out a demonstration at GitHub Universe, or this short walkthrough here.

Happy coding!


View posts by tag

#advice #personal #musings #events #learning #technical #work #meta