DEV Community

Srujana Maddula
Srujana Maddula

Posted on

Automate Pull Requests with Amp

GitHub version control tasks are something that developers mostly automate with AI today, simply because they are repetitive and common. One of the most common tasks is creating a pull request. Usually, every time you push a change to the remote repo, you need to go into the GitHub web interface and manually create a PR.

Or you can do it in commands using GitHub CLI (gh). But with Amp Code, you don’t need to run those commands or open the GitHub UI. You just tell Amp to do that for you.

Set up GitHub CLI

Amp uses GitHub CLI to seamlessly interact with your GitHub repositories, so it needs to be installed and authenticated on your system.

First, install GitHub CLI (gh) with the command below:
brew install gh

Next, run the below command and authenticate with your GitHub credentials:
gh auth login

Once the “gh” setup is complete, you can start using Amp to create and manage pull requests. Let’s see how to do that step by step.

Creating a Pull Request with Amp

Normally, you’d either:

  • Jump into the GitHub web interface to create a PR, or
  • Run a few gh commands from the terminal.

With Amp Code, you skip all that. You just tell Amp what you want. It automatically handles everything: creating a descriptive commit message, committing changes, and opening the PR.

For example, in a Streamlit project, I prompt:

“Review all the changes and create a descriptive commit message, then commit all staged and unstaged changes, then use gh to create a pull request.”

Amp then creates a TO-DO checklist, runs each step in order, and asks for approval along the way. First, it creates the commit message and commit commands and asks for approval.

We can either click “Always Run” or “Run”. “Always Run” means for similar actions, here creating a commit, Amp runs automatically from next time without your approval. “Run” option means Amp runs the commit command for this task.

Approval to run

Next, it asks for approval for the push command. And we can choose between “Always Run” and “Run” to push the changes.

Approval to push the changes

Finally, Amp asks for approval to run the PR commands, creates the PR, and outputs the success message with the link to the PR.

Creates PR

When you click that link, it takes you to the created PR on GitHub.com.

GitHub PR

We can see that Amp doesn’t just create PRs. It handles the whole flow: Reviewing changes, writing a commit message, committing staged and unstaged files, and creating the PR, all from a single prompt.

Top comments (0)