Fundamentals 7 min read

10 Essential Git & GitHub Tips to Boost Your Daily Productivity

This guide compiles ten practical Git and GitHub shortcuts, commands, and tricks—including keyboard shortcuts, URL modifiers, diff formats, and useful CLI commands—to help developers work faster and manage repositories more efficiently.

Liangxu Linux
Liangxu Linux
Liangxu Linux
10 Essential Git & GitHub Tips to Boost Your Daily Productivity

Keyboard shortcuts on GitHub

t : Open fuzzy file‑name search on any source‑code browsing page.

w : Filter branches on a repository’s home page.

? : Show all available shortcuts for the current page.

URL modifiers

Append ?w=1 to any diff URL to collapse whitespace and improve readability.

Use master@{time}..master (e.g., master@{1.day.ago}..master) to filter commits by a time range.

Add ?author=github_handle to a compare URL to view commits by a specific author.

Diff and patch formats

Appending .diff or .patch to a compare, merge‑request, or comment URL returns the raw diff or patch text, useful for offline review or applying patches.

Email replies

You can comment directly on GitHub notification emails; GitHub processes these comments correctly, saving time navigating the web UI.

Linking to specific lines

Click a line number or select multiple lines with SHIFT on a file view; the URL updates to reference those lines, making it easy to share precise code snippets.

Mentioning users

Use @username in pull requests, issues, or comments to automatically subscribe the mentioned user to all subsequent notifications.

Automatic linking

SHA hashes and issue numbers (e.g., #1) are auto‑linked in comments. You can also link to other repositories using user/repo@sha1 or user/repo#1.

Useful Git commands

git log -p FILE

– Show patch history for a specific file. git log -S'PATTERN' – Search commit history for changes containing a pattern. git add -p – Interactively stage or unstage hunks. git rm --cached FILE – Remove a file from the repository history without deleting the local copy. git log ..BRANCH – List commits on a non‑HEAD branch. git branch --merged / git branch --no-merged – Show merged or unmerged branches. git branch --contains SHA – List branches containing a specific commit. git status -s – Show a concise status output. git reflog – Display the local operation history. git shortlog -sn – List contributors by commit count.

Hub command‑line tool

Hub extends Git with GitHub integration. For example, hub pull-request creates a pull request directly from the terminal. Documentation: https://github.com/defunkt/hub#commands

Summary

Mastering these Git and GitHub shortcuts and commands can significantly improve efficiency in version‑control workflows.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DevOpsGitGitHubcommand-lineversion-control
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.