Skip to content

Commit

Permalink
Code search and code view GA (#36512)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie <[email protected]>
Co-authored-by: Melanie Yarbrough <[email protected]>
  • Loading branch information
3 people authored May 8, 2023
1 parent 02232df commit 18f42d9
Show file tree
Hide file tree
Showing 66 changed files with 233 additions and 282 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/help/branches/branch-selection-dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/help/repository/fork_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/help/repository/https-url-clone-cli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/help/repository/new-branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/help/repository/upload-files-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ redirect_from:

## About supported languages

Most {% data variables.product.prodname_dotcom %} features work regardless of which languages your code is written in. You can search for code or enable syntax highlighting based on any language known to {% data variables.product.prodname_dotcom %}. For more information, see "[AUTOTITLE](/search-github/searching-on-github/searching-code#search-by-language)" or "[AUTOTITLE](/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting)."
Most {% data variables.product.prodname_dotcom %} features work regardless of which languages your code is written in. You can search for code or enable syntax highlighting based on any language known to {% data variables.product.prodname_dotcom %}. For more information, see "[AUTOTITLE]{% ifversion code-search-code-view %}(/search-github/github-code-search/understanding-github-code-search-syntax#language-qualifier){% else %}(/search-github/searching-on-github/searching-code#search-by-language){% endif %}" or "[AUTOTITLE](/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting)."

Some {% data variables.product.prodname_dotcom %} products have features that are currently only supported for a subset of programming languages.

Expand Down
14 changes: 7 additions & 7 deletions content/get-started/quickstart/contributing-to-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ You can contribute by submitting pull requests from your fork to the upstream re
This tutorial uses [the Spoon-Knife project](https://github.com/octocat/Spoon-Knife), a test repository that's hosted on {% data variables.product.prodname_dotcom_the_website %} that lets you test the fork and pull request workflow.

1. Navigate to the `Spoon-Knife` project at https://github.com/octocat/Spoon-Knife.
1. Click **Fork**.

![Screenshot of the main page of repository. A button, labeled with a fork icon and "Fork 59.3k," is outlined in dark orange.](/assets/images/help/repository/fork_button.png)
1. In the top-right corner of the page, click **Fork**.
![Screenshot of the main page of repository. A button, labeled with a fork icon and "Fork 59.3k," is outlined in dark orange.](/assets/images/help/repository/fork_button.png)
{%- ifversion fpt or ghec or ghes > 3.5 or ghae > 3.5 %}
1. Under "Owner," select the dropdown menu and click an owner for the forked repository.
1. By default, forks are named the same as their upstream repositories. Optionally, to further distinguish your fork, in the "Repository name" field, type a name.
1. Optionally, in the "Description" field, type a description of your fork.
1. Optionally, select **Copy the DEFAULT branch only**.
2. By default, forks are named the same as their upstream repositories. Optionally, to further distinguish your fork, in the "Repository name" field, type a name.
3. Optionally, in the "Description" field, type a description of your fork.
4. Optionally, select **Copy the DEFAULT branch only**.

For many forking scenarios, such as contributing to open-source projects, you only need to copy the default branch. If you do not select this option, all branches will be copied into the new fork.
1. Click **Create fork**.
5. Click **Create fork**.

{% note %}

Expand Down
4 changes: 2 additions & 2 deletions content/get-started/quickstart/create-a-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ When you created your new repository, you initialized it with a *README* file. *
Let's commit a change to the README file.

1. In your repository's list of files, select **README.md**.

![Screenshot of a list of files in a repository. A file name, "README.md", is highlighted with an orange outline.](/assets/images/help/repository/create-commit-open-readme.png)
{% data reusables.repositories.edit-file-button %}
3. In the text box, type some information about yourself.
1. In the text box, type some information about yourself.
{% data reusables.files.preview_change %}
1. Review the changes you made to the file. If you select **Show diff**, you will see the new content in green.

Expand Down
6 changes: 3 additions & 3 deletions content/get-started/quickstart/fork-a-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ You might fork a project to propose changes to the upstream repository. In this

1. On {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom_the_website %}{% else %}{% data variables.location.product_location %}{% endif %}, navigate to the [octocat/Spoon-Knife](https://github.com/octocat/Spoon-Knife) repository.
1. In the top-right corner of the page, click **Fork**.

![Screenshot of the main page of repository. A button, labeled with a fork icon and "Fork 59.3k," is outlined in dark orange.](/assets/images/help/repository/fork_button.png)
{%- ifversion fpt or ghec or ghes > 3.5 or ghae > 3.5 %}
1. Under "Owner," select the dropdown menu and click an owner for the forked repository.
1. By default, forks are named the same as their upstream repositories. Optionally, to further distinguish your fork, in the "Repository name" field, type a name.
1. Optionally, in the "Description" field, type a description of your fork.
2. By default, forks are named the same as their upstream repositories. Optionally, to further distinguish your fork, in the "Repository name" field, type a name.
3. Optionally, in the "Description" field, type a description of your fork.
{%- ifversion fpt or ghec or ghes > 3.6 or ghae > 3.6 %}
1. Optionally, select **Copy the DEFAULT branch only**.

Expand Down
15 changes: 10 additions & 5 deletions content/get-started/quickstart/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ Here at {% data variables.product.product_name %}, our developers, writers, and
### Create a branch

1. Click the **Code** tab of your `hello-world` repository.
1. Above the file list, click the dropdown menu that says **main**.

2. Above the file list, click the dropdown menu that says **main**.
![Screenshot of the repository page. A dropdown menu, labeled with a branch icon and "main", is highlighted with an orange outline.](/assets/images/help/branches/branch-selection-dropdown.png)
1. Type a branch name, `readme-edits`, into the text box.
1. Click **Create branch: readme-edits from main**.

3. Type a branch name, `readme-edits`, into the text box.
4. Click **Create branch: readme-edits from main**.

![Screenshot of the branch dropdown for a repository. "Create branch: readme-edits from 'main'" is outlined in dark orange.](/assets/images/help/repository/new-branch.png)

Now you have two branches, `main` and `readme-edits`. Right now, they look exactly the same. Next you'll add changes to the new branch.

## Making and committing changes
Expand All @@ -88,8 +87,14 @@ You can make and save changes to the files in your repository. On {% data variab
1. Under the `readme-edits` branch you created, click the _README.md_ file.
1. To edit the file, click {% octicon "pencil" aria-label="Edit file" %}.
1. In the editor, write a bit about yourself. Try using different Markdown elements.
{% ifversion code-search-code-view %}
1. Click **Commit changes...**.
1. In the "Propose changes" box, write a commit message that describes your changes.
1. Click **Propose changes**.
{% else %}
1. In the "Commit changes" box, write a commit message that describes your changes.
1. Click **Commit changes**.
{% endif %}

These changes will be made only to the README file on your `readme-edits` branch, so now this branch contains content that's different from `main`.

Expand Down
13 changes: 13 additions & 0 deletions content/get-started/using-github/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ For more keyboard shortcuts, see the [CodeMirror documentation](https://codemirr
|<kbd>A</kbd> | Show or hide annotations on diffs
|<kbd>B</kbd> | Open blame view. For more information, see "[AUTOTITLE](/repositories/working-with-files/using-files/viewing-a-file)."

{% ifversion code-search-code-view %}

## Navigating within code files

If you view a code file in a repository using the **Code** view and click on any line in the file, you will see a cursor. You can then navigate within the content of the file, also known as a blob (binary large object), using keyboard shortcuts.

| Keyboard shortcut | Description
|-----------|------------
|<kbd>Shift</kbd>+<kbd>J</kbd>| Highlights the line that is currently selected by the cursor within the code file
|<kbd>Shift</kbd>+<kbd>F10</kbd> | If a line of code is currently selected, this shortcut opens the line menu for that line, appearing under {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} to the left of the line
|<kbd>Command</kbd>+<kbd>Enter</kbd> (Mac) or </br> <kbd>Control</kbd>+<kbd>Enter</kbd> (Windows/Linux) | Highlights the code symbol currently selected by the cursor and all other occurences of the symbol in the code, and shows the symbol in the symbols pane
{% endif %}

## Comments

| Keyboard shortcut | Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ You can pin gists to your profile so other people can see them easily. For more

{% endif %}

You can discover {% ifversion ghae %}internal{% else %}public{% endif %} gists others have created by going to the {% data variables.gists.gist_homepage %} and clicking **All Gists**. This will take you to a page of all gists sorted and displayed by time of creation or update. You can also search gists by language with {% data variables.gists.gist_search_url %}. Gist search uses the same search syntax as [code search](/search-github/searching-on-github/searching-code).
You can discover {% ifversion ghae %}internal{% else %}public{% endif %} gists others have created by going to the {% data variables.gists.gist_homepage %} and clicking **All Gists**. This will take you to a page of all gists sorted and displayed by time of creation or update. You can also search gists by language with {% data variables.gists.gist_search_url %}. {% ifversion ghes or ghae %}Gist search uses the same search syntax as [code search](/search-github/searching-on-github/searching-code).{% endif %}

Since gists are Git repositories, you can view their full commit history, complete with diffs. You can also fork or clone gists. For more information, see "[AUTOTITLE](/get-started/writing-on-github/editing-and-sharing-content-with-gists/forking-and-cloning-gists)."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ You can create a branch in different ways on {% data variables.product.product_n

### Creating a branch using the branch dropdown
{% data reusables.repositories.navigate-to-repo %}
{% ifversion code-search-code-view %}
1. Select the {% octicon "git-branch" aria-hidden="true" %} branch dropdown menu, in the file tree view or at the top of the integrated file editor.

![Screenshot of the file tree view for a repository. A dropdown menu for branches is outlined in dark orange.](/assets/images/help/branches/file-tree-view-branch-dropdown.png)
{% else %}
1. Select the branch selector dropdown menu.

![Screenshot of the repository page. A dropdown menu, labeled with a branch icon and "main", is highlighted with an orange outline.](/assets/images/help/branches/branch-selection-dropdown.png)
1. Optionally, if you want to create the new branch from a branch other than the default branch of the repository, click another branch, then select the branch selector dropdown menu again.
{% endif %}
1. Optionally, if you want to create the new branch from a branch other than the default branch of the repository, click another branch, then select the branch dropdown menu again.
1. In the "Find or create a branch..." text field, type a unique name for your new branch, then click **Create branch**.

![Screenshot of the branch selector dropdown menu. "Create branch: new-branch" is highlighted with an orange outline.](/assets/images/help/branches/create-branch-text.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ shortTitle: View branches
---
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.navigate-to-branches %}
3. Use the navigation at the top of the page to view specific lists of branches:
1. Use the navigation at the top of the page to view specific lists of branches:
- **Your branches**: In repositories that you have push access to, the **Yours** view shows all branches that you’ve pushed to, excluding the default branch, with the most recent branches first.
- **Active branches**: The **Active** view shows all branches that anyone has committed to within the last three months, ordered by the branches with the most recent commits first.
- **Stale branches**: The **Stale** view shows all branches that no one has committed to in the last three months, ordered by the branches with the oldest commits first. Use this list to determine [which branches to delete](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository).
- **All branches**: The **All** view shows the default branch, followed by all other branches ordered by the branches with the most recent commits first.

4. Optionally, use the search field on the top right. It provides a simple, case-insensitive, sub-string search on the branch name. It does not support any additional query syntax.
1. Optionally, use the search field on the top right. It provides a simple, case-insensitive, sub-string search on the branch name. It does not support any additional query syntax.

## Further reading

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Creating a repository from a template is similar to forking a repository, but th
For more information about forks, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)."

## Creating a repository from a template

{% data reusables.repositories.navigate-to-repo %}
1. Above the file list, click **Use this template**.
{% ifversion fpt or ghec %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Files that you add to a repository via a browser are limited to {% data variable
{% endtip %}

{% data reusables.repositories.navigate-to-repo %}
1. Above the list of files, select the **Add file** dropdown menu and click **Upload files**.

1. Above the list of files, select the **Add file** dropdown menu and click **Upload files**. Alternatively, you can drag and drop files into your browser.
![Screenshot of the main page of the repository. Above the list of a files, a button, labeled "Add file," is outlined in dark orange.](/assets/images/help/repository/upload-files-button.png)
1. To select the files you want to upload, drag and drop the file or folder, or click **choose your files**.
{% data reusables.files.commit-message %}
{% data reusables.files.choose_commit_branch %}
1. Click **Commit changes**.
1. Click **Propose changes**.

## Adding a file to a repository using the command line

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ When creating a file on {% data variables.product.product_name %}, consider the
1. In the file name field, type the name and extension for the file. To create subdirectories, type the `/` directory separator.
1. In the file contents text box, type content for the file.
1. To review the new content, above the file contents, click **Preview**.

![Screenshot of a file in edit mode. Above the text box for editing file contents, a tab, labeled "Preview", outlined in dark orange.](/assets/images/help/repository/new-file-preview.png)
{% ifversion code-search-code-view %}
![Screenshot of a file in edit mode. Above the text box for editing file contents, a tab, labeled "Preview", outlined in dark orange.](/assets/images/help/repository/new-file-preview.png)
{% else %}
![Screenshot of a file in edit mode. Above the text box for editing file contents, a tab, labeled "Preview", outlined in dark orange.](/assets/images/enterprise/repository/new-file-preview.png)
{% endif %}
{% data reusables.files.write_commit_message %}
{% data reusables.files.choose-commit-email %}
{% data reusables.files.choose_commit_branch %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ If the file{% ifversion fpt or ghes or ghec %} or directory{% endif %} you delet
## Deleting a file

1. Browse to the file in your repository that you want to delete.
1. In the top-right corner, select the {% octicon "kebab-horizontal" aria-label="More options" %} dropdown menu, then click **Delete file**.
{% ifversion code-search-code-view %}
1. In the top-right corner, select the {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} dropdown menu, then click **Delete file**.

![Screenshot of the file list for a directory. To the right of the directory name, a button, labeled with a kebab icon, is outlined in dark orange.](/assets/images/help/repository/delete-file-button.png)
{% else %}
1. At the top of the file, click {% octicon "trash" aria-label="The trash icon" %}.
{% endif %}
{% data reusables.files.commit-message %}
{% data reusables.files.choose-commit-email %}
{% data reusables.files.choose_commit_branch %}
Expand All @@ -39,7 +45,7 @@ If the file{% ifversion fpt or ghes or ghec %} or directory{% endif %} you delet

1. Browse to the directory in your repository that you want to delete.
1. In the top-right corner, select the {% octicon "kebab-horizontal" aria-label="More options" %} dropdown menu, then click **Delete directory**.

![Screenshot of the file list for a directory. To the right of the directory name, a button, labeled with a kebab icon, is outlined in dark orange.](/assets/images/help/repository/delete-directory-button.png)
1. Review the files you will delete.
{% data reusables.files.commit-message %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ children:
- /renaming-a-file
- /deleting-files-in-a-repository
- /customizing-how-changed-files-appear-on-github
- /navigating-files-with-the-new-code-view
---

Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ In addition to changing the file location, you can also [update the contents of
{% endtip %}

1. In your repository, browse to the file you want to move.
1. In the upper right corner of the file view, click {% octicon "pencil" aria-label="Edit file" %} to open the file editor.

![Screenshot of a file. In the header, a button, labeled with a pencil icon, is outlined in dark orange.](/assets/images/help/repository/edit-file-edit-button.png)
{% data reusables.repositories.edit-file %}
1. In the filename field, change the name of the file using these guidelines:
- To move the file **into a subfolder**, type the name of the folder you want, followed by `/`. Your new folder name becomes a new item in the navigation breadcrumbs.
- To move the file into a directory **above the file's current location**, place your cursor at the beginning of the filename field, then either type `../` to jump up one full directory level, or type the `backspace` key to edit the parent folder's name.
Expand Down
Loading

0 comments on commit 18f42d9

Please sign in to comment.