### 1.
**GitHub Actions Workflow for Branch-Specific Commits**
You can create custom workflows for specific branches to trigger actions only when
changes happen on those branches.
```yaml
name: Branch-Specific Workflow
on:
push:
branches:
- 'main'
```
This ensures that certain workflows, like deployment or CI/CD, only run on specific
branches, making them more targeted.
---
### 2. **Auto-Link Issues to Commits via Commit Messages**
You can automatically link your commits to GitHub issues by referencing the issue
number in your commit message. For example:
```
git commit -m "Fixes #42: Corrected the bug in the login form"
```
This will automatically link commit `#42` to the related issue and close it if the
phrase "Fixes" or "Closes" is used.
---
### 3. **GitHub Keyboard Shortcuts**
GitHub has a built-in set of keyboard shortcuts that many users don't know about.
Some useful ones include:
- `t` - Quickly search for a file within a repository.
- `y` - Permalink to a specific line of code in a file.
- `i` - Focus on the Issues page.
- `p` - Focus on the Pull Requests page.
- `?` - Show a full list of keyboard shortcuts.
This can speed up navigation and reduce reliance on the mouse.
---
### 4. **GitHub Pages for Documentation**
If you have a project repository, you can use **GitHub Pages** to host
documentation directly from the repository without any extra tools. Simply create a
`docs/` folder, add markdown files, and configure the Pages settings in the
repository settings.
---
### 5. **Code Folding in GitHub Gists**
GitHub Gists support code folding, which helps organize long pieces of code in a
compact view. If you write a Gist with multiple code blocks, users can click to
expand and collapse sections.
---
### 6. **View a Repository’s File History (Blame)**
You can check the history of a file and see who last modified each line using
**GitHub Blame**. In any file, click on the `Blame` button to see a detailed line-
by-line commit history.
---
### 7. **Customizing Your GitHub Profile with Markdown**
You can use **README.md** files to customize your GitHub profile by creating a
repository with the same name as your username (e.g., `username/username`). GitHub
will display the `README.md` of that repository on your profile page.
---
### 8. **GitHub Gist Embed in Websites or Blogs**
You can embed any Gist into your website or blog by using the embed code provided
by GitHub. Click on the `Embed` option on the Gist page and copy the HTML iframe
code.
Example:
```html
<script src="https://gist.github.com/username/gistid.js"></script>
```
This allows you to display code snippets directly on your site, and it auto-updates
when the Gist is updated.
---
### 9. **Revert a Pull Request with a Single Click**
If you've merged a pull request that caused issues, you can quickly revert it by
clicking the "Revert" button on the merged PR page (only if the PR was merged).
This automatically generates a new pull request to undo the changes from the
original one.
---
### 10. **GitHub Search with Filters**
GitHub’s search functionality is much more powerful than most people realize. You
can filter your search results using various options like:
- `is:issue` - Find only issues.
- `is:pr` - Find only pull requests.
- `author:username` - Find issues or PRs created by a specific user.
- `label:bug` - Search for issues with the `bug` label.
- `sort:updated` - Sort search results by the most recently updated.
For example, searching for all issues with the `bug` label would look like this:
```
label:bug is:issue repo:username/repo
```