> For AI agents: the complete documentation index is available at https://nhanbe.id.vn/llms.txt, the full documentation bundle is available at https://nhanbe.id.vn/llms-full.txt.

# GitHub Desktop

## Viewing History

Left sidebar **History** tab:

- Displays all commits on the currently checked-out branch.
- Select a commit to inspect its diff panel on the right.
- Right-click a commit for actions:
  - Revert this commit
  - Reset to this commit
  - Cherry-pick to branch
  - Create branch from commit
  - Copy SHA

## Inline Diff

Default view presenting additions and deletions within a single unified panel.

## Side-by-Side Diff

Click the **Split view** icon located at the top right of the diff panel.

## Hide Whitespace Changes

Navigate to menu **File → Hide Whitespace Changes** — useful when code formatting mutates numerous lines across files.

## Expand Context Lines

Click `+` or `-` icons within the diff viewer to expand context lines surrounding changes.

***

## Partial Commits (Line-by-Line Staging)

Use Case: Multiple unrelated modifications exist in a single file, but require separate commits.

1. Select target file in the **Changes** list.
2. Hover over line numbers in the diff panel to display selection checkboxes.
3. Check only the specific lines intended for inclusion in the commit.
4. Execute commit — only checked lines are committed.

Alternative: Hover over a diff hunk → click **Discard hunk** or select specific hunks for staging.

## Stashing

Navigate to **Branch → Stash all changes** — temporarily stores working directory changes when switching branches.

Select **Branch → Restore stash** to reapply changes.

**AEM Development Example:** Working on Feature A when an urgent bug requires immediate attention → stash changes → switch branch and apply fix → return to feature branch and restore stash.

## Pull Requests

Click **Create Pull Request** after pushing a branch.

- GitHub Desktop launches browser to the pull request creation page.
- Native integration available for GitHub repositories.
- Azure DevOps / GitLab repositories redirect to corresponding remote web interfaces.

## Merge & Rebase

### Merging Another Branch into Current Branch

Select **Branch → Merge into current branch** (`Ctrl+Shift+M`):

- Select target source branch.
- Click **Create a merge commit**.

### Rebasing

Select **Branch → Rebase current branch** (`Ctrl+Shift+E`):

- Select target base branch (typically `develop` or `main`).
- Click **Start rebase**.

**Typical AEM Workflow:**

1. Branch `feature/AMS-1234` from `develop`.
2. Commit implementation changes.
3. Prior to merging: rebase onto `develop` to ensure a clean linear history.
4. Push changes (use `--force-with-lease` if previously pushed).
5. Open Pull Request.

***

## Resolving Merge Conflicts

When conflicts occur during a merge or rebase:

1. GitHub Desktop lists conflicting files.
2. Click **Open in editor** (launches VS Code or configured editor).
3. Conflict markers appear in code: `<<<<<<<`, `=======`, `>>>>>>>`.
4. Resolve conflicts in editor and save file.
5. Return to GitHub Desktop → click **Continue merge** or **Continue rebase**.

***

## Co-Authors

Within the commit message panel → expand **Add Co-authors**:

```text
Co-authored-by: Name <email@example.com>
```

GitHub recognizes co-author annotations and displays multiple contributor avatars on the commit.

## Repository Settings

Navigate to **Repository → Repository settings**:

- **Remote** — update remote repository URLs.
- **Branch** — modify default branch designation.
- **Git LFS** — manage Large File Storage options.
- **Git Ignore** — edit `.gitignore` rules directly within app.
- **Git Config** — set repository-specific configurations (`user.name`, `user.email`).

***

## Keyboard Shortcuts

| Shortcut       | Action                     |
| -------------- | -------------------------- |
| `Ctrl+1`       | Open Changes tab           |
| `Ctrl+2`       | Open History tab           |
| `Ctrl+T`       | Show repository list       |
| `Ctrl+P`       | Push changes to remote     |
| `Ctrl+Shift+P` | Pull changes from remote   |
| `Ctrl+Shift+N` | Create new branch          |
| `Ctrl+B`       | Show branch selector       |
| `Ctrl+Shift+M` | Merge into current branch  |
| `Ctrl+Shift+E` | Rebase current branch      |
| `Ctrl+Enter`   | Commit staged changes      |
| `Ctrl+,`       | Open Preferences           |
| `Ctrl+Shift+G` | Show file in File Explorer |

***

## Integration with External Editors

Navigate to **File → Options → Integrations**:

- **External Editor:** select VS Code, IntelliJ IDEA, etc.
- **Shell:** select PowerShell, Git Bash, Command Prompt.

Then use shortcuts:

- `Ctrl+Shift+A` → Open repository in external editor.
- \`Ctrl+\`\` → Open repository terminal shell.

## Multi-Repository Management

Top-left repository dropdown lists all cloned repositories.

Quick switch between repositories: press `Ctrl+T` → search repository name.

**AEM Workspace Setup Example:**

```text
- mysite (main project)
- mysite-dispatcher
- mysite-cicd
```

Open separate repositories in GitHub Desktop to switch contexts quickly.

***

## Limitations & CLI Workarounds

### Unsupported UI Operations

- Submodule operations (submodules require Git CLI execution).
- Advanced interactive rebase (reordering, editing historic commits).
- Cherry-picking arbitrary commit ranges.
- Git bisect workflows.

### Workaround: Launching Git CLI

Select **Repository → Open in Shell** (\`Ctrl+\`\`) to execute complex Git CLI commands.

```bash
# Interactive rebase of last 3 commits
git rebase -i HEAD~3

# Cherry-pick a range of commits
git cherry-pick abc123..def456
```
