So friends… who’s been upping their code game with the wonderful GitHub Copilot 👀 I know I certainly have! Keep reading to find out more about it and how it can change the way YOU write code 👨🏻💻 🚀
What is it?
So, in the words of Bing Copilot…
GitHub Copilot is an awesome tool that makes coding easier and smarter with artificial intelligence. You can use it with different code editors like Visual Studio Code, Visual Studio, Neovim, and JetBrains. GitHub Copilot can give you code hints based on what you write or comment. You can also learn from the code it makes and tweak your editor settings. GitHub Copilot is made by GitHub, which is part of Microsoft, and OpenAI, which is a cool group that wants to create super smart AI. GitHub Copilot uses a powerful AI model that learned from billions of lines of code .
Bing Chat with GPT-4
How to use it, and for what?
Explaining code
So let’s actually dive into some of the things you can do with GitHub Copilot! Let’s start with a file I’ve already written some code for that I’m handing off to another developer. They want to be able to understand my code super quickly and they’re going to ask GitHub Copilot for some help with that.
For a scenario like this, I’ll simply open the code file and ask GitHub Copilot, “Can you explain what this code does?”
So you can see above I asked GitHub the question, and it explained what the code in my Inclusive AI Bot does! Incredible! Say goodbye to weeks on weeks of reverse engineering friends! 😍
Writing code
Now let’s say I want some code to do something. I’m going to say that I want a function written that I can pass an array of strings, and I want the code to output a single string which has all of those previous strings contained within it separated by commas. Let’s see what Copilot does…
Awesome! GitHub Copilot gave me exactly what I wanted! It was that simple! But actually, I would’ve preferred the same logic in JavaScript. I’m going to say to GitHub Copilot… “Can you give me the same thing in JavaScript?”
And just like that, GitHub Copilot produced the same thing for me in JavaScript! Amazing!
How can you fine tune your use of GitHub Copilot?
GitHub Copilot is a powerful tool that can help you write code faster and smarter. But how can you make the most of it? Here are three quick tips to get you started.
- Use descriptive comments and variable names. GitHub Copilot uses natural language processing to understand your intent and generate relevant code suggestions. The more clear and specific you are with your comments and variable names, the better Copilot can assist you.
- Review and edit the suggestions. GitHub Copilot is not perfect, and sometimes it may generate code that is incorrect, incomplete, or insecure. Always review the suggestions before accepting them, and make any necessary edits to ensure the quality and safety of your code.
- Explore different alternatives. GitHub Copilot can generate multiple suggestions for the same problem, and you can cycle through them by pressing Ctrl+Enter (or Cmd+Enter on Mac). You may find a better solution, or learn a new way of doing something, by exploring different alternatives.
What are you doing with it?
So, have a play with GitHub Copilot! Let me know what you’re using it for in the comments so we can all share great ideas in this space! Happy coding friends! 🚀 💖
Did you like this content? 💖
Did you like this content? Check out some of the other posts on my blog, and if you like those too, be sure to subscribe to get my posts directly in your inbox for free!
Subscribe