Code, commit, and control what you share
1. Code, commit, and control what you share
Hey there, welcome back!2. Where we left off
In this video, we'll learn how to work with3. Where we left off
Git inside Cursor and keep our project secure while doing it. By the end of this video, we'll also learn4. Where we left off
how to create custom commands to automate repetitive tasks. We'll continue with our Next.js portfolio app, which now has a working homepage and images. Before pushing any changes, let's make sure everything is versioned and safe.5. Committing changes
Let's start by opening the Git tab in Cursor. Here, we can see all our file changes — for example, the updates we made to page.tsx when we fixed the background image. Cursor automatically detects these unstaged changes. Let's stage them all and create a commit. Normally, we'd type a commit message like "updated homepage image and layout." But with Cursor, we can save time by letting AI write it for us. Just click the "Generate commit message" icon, and Cursor reads the diff to summarize what changed and generate a commit message that's clean, clear, and ready to commit. We can review the message, tweak it if needed, and hit Commit. If we have linked our GitHub account to cursor then this will automatically create a repository and commit changes to it that we can view on our GitHub account.6. Merging conflicts with Cursor
At times, when we pull the latest updates from our remote repo, we might get a merge conflict — maybe someone else changed the same file.7. Merging conflicts with Cursor
In that case, Cursor detects the merge conflict, showing the conflict markers directly in the editor. Click the Resolve in Chat button that appears in the merge conflict UI. The Cursor Agent will analyze both versions and suggest a resolution. We can review and approve the diff before saving — no need to manually edit conflict markers.8. The .cursorignore file
Next, let's see how Cursor keeps our code private. Cursor includes a .cursorignore file — similar to .gitignore. This file tells the AI which files or folders not to read. For example, we might want to ignore our .env file or our /config directory. If we just add them inside .cursorignore, Cursor won't use them as context.9. Privacy Mode
And if we ever want to take privacy a step further, we can toggle Privacy Mode on inside the Cursor Settings Tab. When Privacy Mode is enabled, Cursor won't send any local data or file content to its cloud.10. Custom commands
Once our code is versioned and secure, we can speed up our work using custom commands, which let us automate repetitive tasks. For instance, we can create a command to create pull requests, so that we don't have to repeat the same process again and again.11. Custom commands
Inside the .cursor folder in the root of our project, we'll create another subfolder where we'll create markdown files of all the commands we want. Let's create a PR.md file for pull requests and add whatever prompt we want. Inside this markdown file, we can add more rules and guidelines for Cursor to follow upon invoking this command. Now, next time we type inside our agent / we see /pr as a custom command option, and Cursor runs that PR workflow for us. We can create as many custom commands as we want for efficient coding.12. Let's practice!
Let's practice some custom commands!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.