# GitHub and pull requests

Work on the issues, pull requests and commits of your GitHub repository from the code editor.

The **GitHub** view of the code editor links your project to a GitHub repository. You push and pull, browse and open issues and pull requests, review and merge, and follow the commits and workflow runs on GitHub, without leaving Lyna. The full guide is on the [GitHub integration](/integrations/github) page.

The GitHub view with a linked repository, its sync status, and the list of pull requests with their state and checks.

## What you can do

- Create a repository for your project, or link one you already have.
- Push your commits, pull the changes made on GitHub, and see if your branch is in sync.
- Filter and search the issues and pull requests of the repository.
- Open an issue or a pull request as a page in the editor area: comment, edit, label, assign, close or reopen it.
- Review a pull request, merge it, or turn it into a draft and back.
- Create issues and pull requests with labels, assignees, a milestone and reviewers.
- See the commits on GitHub as a graph, and the workflow runs and deployments.
- Add a workflow from a template that runs your project's own scripts.

## Open the GitHub view

1. ### Open the view

   In **Code** mode, choose **GitHub** in the views rail.
2. ### Connect GitHub

   Choose **Connect GitHub** and install the Lyna GitHub App on your account or organization. You choose which repositories it can reach.
3. ### Create or link

   - **Create Repository**: pick the **Owner** (your personal account or an organization), a **Repository name**, and **Public** or **Private**.
   - **Link Existing Repository**: search your repositories, or type `owner/repo`.

To stop syncing, choose **Unlink Repository** in **More GitHub actions**. This removes the link, not the repository on GitHub.

## The four tabs

| Tab               | What it shows                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Pull requests** | Each pull request with its state (**Open**, **Draft**, **Merged**, **Closed**), its checks and its review state.                                                                                                                                                                                                                                                                                                                                                       |
| **Issues**        | Each issue with its labels, assignees and comment count.                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Commits**       | The commits on GitHub, drawn as the same graph as Source Control.                                                                                                                                                                                                                                                                                                                                                                                                      |
| **Activity**      | The workflow runs (**Succeeded**, **Failed**, **In Progress**, **Queued**...) and the deployments. A run opens its page with its jobs, steps and log, where you can cancel or re-run it ([details](/integrations/github#activity)). **New Workflow** adds a workflow from a template: checks on each push, a scheduled or manual script, or a deploy, on a new branch with its pull request or on the current branch ([details](/integrations/github#add-a-workflow)). |

In **Pull requests** and **Issues**, **Show** picks **Open**, **Closed** or **All**, the search field finds items by their words, and the list loads more items as you scroll.

**Open GitHub graph**, next to **Check sync status** at the top of the view, opens every branch on GitHub with its commits in the editor area, with **Fetch**, **Pull** and **Push** in its toolbar ([details](/features/code/branch-graph#the-github-graph)).

## Issue and pull request pages

Choose a row to open its page in the editor area, beside your files. The page holds the description and the comments, a Markdown comment box with **Write** and **Preview**, and the side details: assignees, labels, milestone, and the branches and pull requests linked to an issue.

- **Close issue**, **Close as not planned** and **Reopen issue** change an issue's state.
- **Create a branch** makes a branch for an issue on GitHub, ready to switch to.
- **Send to AI** puts the issue's text in the chat box for Lyna AI. Nothing is sent until you send it.
- A pull request page adds its reviewers, its checks and the merge box: **Merge pull request**, **Squash and merge** or **Rebase and merge**, then **Delete branch**.

## Review a pull request

On a pull request page, choose **Review changes**. The review opens in the editor area with the pull request's title and number, the branch it merges into, and **Back to PRs** to return to its page.

The review page of a pull request: the Files list with each file's status, line counts and comments, the diff with a comment thread under a line, and the review summary with the Submit Review button at the bottom.

1. ### Read the changes

   **Files** lists each changed file with its status, its added and removed lines and its number of comments. Choose a file to go to its diff. The comments already left show as threads under their lines, and a thread on lines that changed since reads **Outdated**.
2. ### Comment on a line

   Select a line of the diff. Write in **Leave a review comment**, under **Comment on** and the file and line, then choose **Post comment**. To answer a thread, write in **Reply to this thread** and choose **Reply**.
3. ### Fix a file in place

   Choose **Edit** in a file's header to change it right in the review, then **Save**: Lyna commits the file to the pull request's branch. **Cancel** drops the edit. You edit one file at a time, and a binary or very large file cannot be edited here. If the file changed on the branch since you opened it, the save stops and says so.
4. ### Submit your review

   Write a summary in **Add Comment**, then open **Submit Review** and choose **Comment**, **Approve** or **Request Changes**.

To find issues in your own changes before you open a pull request, run [Agent Review](/features/code/agent-review).

## Create an issue or a pull request

- **New Issue** in the **Issues** tab opens a new issue page: a **Title**, a Markdown **Description**, and its assignees, labels and milestone. Choose **Create Issue**.
- **Create Pull Request** in the **Pull requests** tab opens a new pull request page. Pick the **Base branch** and the **From branch**, write the **Title** and the **Description**, add reviewers, then choose **Create Pull Request**, or **Create Draft Pull Request** in **More ways to create**.

New pages stay open as drafts while you look at something else, and the created item takes the page's place.

## Push and pull

The view shows the sync status of your branch: **Up to date**, how many commits it is ahead of GitHub or behind it, or **Not on GitHub yet**. **Check sync status** reads it again.

- **Push** sends your commits to GitHub.
- **Pull** brings in commits from GitHub. **Pull with Rebase** puts your local commits on top of them.
- **Force Push** replaces the history on GitHub with yours.

> [!WARNING]
>
> **Force push cannot be undone**
>
> **Force Push** overwrites the remote history. Commits that only exist on GitHub are lost. Use it only when you mean to.

Only committed work is pushed. Commit your changes in [Source Control](/features/code/git) first.

## FAQ

### Is GitHub required to keep my history?

No. Your commits are saved with your project in Lyna cloud storage. GitHub is optional. See [Git](/features/code/git).

### Can I use the command palette for Git?

Yes. Push, pull and fetch are in the command palette (`Cmd/Ctrl + K`) once a repository is linked.

### Why can I not create a pull request?

A pull request needs two branches on GitHub: the base branch and the branch with your work. When GitHub has only one, the page says so. Create a branch, commit your work on it, push it, then pick it as the **From branch**.

### Can Lyna AI work on GitHub for me?

Yes. Ask it in the chat to list, read, create or close issues, open or merge pull requests, push or pull. Every change on GitHub waits for your approval. See [Ask Lyna AI](/integrations/github#ask-lyna-ai).

## Related

- [GitHub integration](/integrations/github): The full guide: issues, pull requests, branches and Lyna AI.
- [Git](/features/code/git): Commit and manage branches.
- [Agent Review](/features/code/agent-review): Find issues in your changes before you open a pull request.
- [Branch graph](/features/code/branch-graph): See your history as a graph.
