Tips and shortcuts for managing Git repositories using GitHub Desktop
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.
- Select target file in the Changes list.
- Hover over line numbers in the diff panel to display selection checkboxes.
- Check only the specific lines intended for inclusion in the commit.
- 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
developormain). - Click Start rebase.
Typical AEM Workflow:
- Branch
feature/AMS-1234fromdevelop. - Commit implementation changes.
- Prior to merging: rebase onto
developto ensure a clean linear history. - Push changes (use
--force-with-leaseif previously pushed). - Open Pull Request.
Resolving Merge Conflicts
When conflicts occur during a merge or rebase:
- GitHub Desktop lists conflicting files.
- Click Open in editor (launches VS Code or configured editor).
- Conflict markers appear in code:
<<<<<<<,=======,>>>>>>>. - Resolve conflicts in editor and save file.
- Return to GitHub Desktop → click Continue merge or Continue rebase.
Co-Authors
Within the commit message panel → expand Add Co-authors:
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
.gitignorerules directly within app. - Git Config — set repository-specific configurations (
user.name,user.email).
Keyboard Shortcuts
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:
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.