Code search and code view GA (#36512)
Co-authored-by: Sophie <29382425+sophietheking@users.noreply.github.com> Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com>
BIN
assets/images/enterprise/repository/blame-button.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
assets/images/enterprise/repository/edit-file-edit-button.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 41 KiB |
BIN
assets/images/enterprise/repository/git-blame.png
Normal file
|
After Width: | Height: | Size: 137 KiB |
BIN
assets/images/enterprise/repository/new-file-preview.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
assets/images/enterprise/repository/raw-file-button.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 77 KiB |
BIN
assets/images/help/branches/file-tree-view-branch-dropdown.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/images/help/repository/add-files-buttons.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
assets/images/help/repository/delete-file-button.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 79 KiB |
@@ -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.
|
||||
|
||||
|
||||
@@ -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**.
|
||||
|
||||

|
||||
1. In the top-right corner of the page, click **Fork**.
|
||||
|
||||

|
||||
{%- 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 %}
|
||||
|
||||
|
||||
@@ -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**.
|
||||
|
||||
|
||||

|
||||
{% 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.
|
||||
|
||||
|
||||
@@ -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**.
|
||||
|
||||
|
||||

|
||||
{%- 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**.
|
||||
|
||||
|
||||
@@ -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**.
|
||||

|
||||
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**.
|
||||
|
||||

|
||||
|
||||
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
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)."
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||

|
||||
{% else %}
|
||||
1. Select the branch selector dropdown menu.
|
||||
|
||||

|
||||
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**.
|
||||
|
||||

|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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.
|
||||
|
||||

|
||||
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
|
||||
|
||||
|
||||
@@ -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**.
|
||||
|
||||

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

|
||||
{% else %}
|
||||

|
||||
{% endif %}
|
||||
{% data reusables.files.write_commit_message %}
|
||||
{% data reusables.files.choose-commit-email %}
|
||||
{% data reusables.files.choose_commit_branch %}
|
||||
|
||||
@@ -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**.
|
||||
|
||||

|
||||
{% 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 %}
|
||||
@@ -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**.
|
||||
|
||||
|
||||

|
||||
1. Review the files you will delete.
|
||||
{% data reusables.files.commit-message %}
|
||||
|
||||
@@ -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
|
||||
---
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||

|
||||
{% 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.
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
---
|
||||
title: Navigating files with the new code view (beta)
|
||||
intro: 'With the new code view (beta), you can view your code in context with an easily navigable file tree and integrated symbol search.'
|
||||
allowTitleToDifferFromFilename: true
|
||||
versions:
|
||||
feature: file-tree-view
|
||||
topics:
|
||||
- Repositories
|
||||
shortTitle: New code view (beta)
|
||||
---
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note**: {% data reusables.search.code-search-code-view-beta-note %}
|
||||
|
||||
{% data reusables.search.code-search-link %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## About the new code view (beta)
|
||||
The new code view beta improves navigation with a file tree view, simplifies file editing, introduces a symbols pane for symbol search and navigation, and updates the blame view to maintain file context. The new code view is integrated with a new code search engine and search interface in a public beta on {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.search.code-search-link %}
|
||||
|
||||
To provide feedback on the new code view beta, see the [discussion forum](https://github.com/orgs/community/discussions/categories/repositories).
|
||||
|
||||
## Enabling and disabling the new code search and code view (beta)
|
||||
|
||||
{% data reusables.search.enabling-and-disabling-code-search-and-view-beta %}
|
||||
|
||||
## Using the file tree view
|
||||
The new file tree view is a panel that displays a repository's directories and files within an easily navigable tree. You can move between directories and files quickly and understand the context for each item you view.
|
||||
|
||||
1. Select a repository, then click a directory or file within that repository to open the file tree view.
|
||||
1. To search for a specific directory or file, in the file tree view, click the {% octicon "filter" aria-hidden="true" %} **Jump to file** search bar, then type the directory or file name and select the directory or file from the results. You can view the file path for a directory or file below each search result.
|
||||
|
||||

|
||||
|
||||
- To search within the repository using the {% data variables.product.prodname_dotcom %} search bar, click {% octicon "search" aria-label="The search icon" %} in the file tree view.
|
||||
|
||||
1. To switch between branches, select the {% octicon "git-branch" aria-hidden="true" %} branch dropdown menu, then click the desired branch from the results. To view all branches for a repository, click **View all branches**.
|
||||
|
||||

|
||||
|
||||
1. To switch between tags, select the {% octicon "git-branch" aria-hidden="true" %} branch dropdown menu, click the **Tags** tab, then click the desired tag from the results. To view all tags for a repository, click **View all tags**.
|
||||
|
||||

|
||||
|
||||
## Working with files
|
||||
The new code view also includes updates to the ways in which you work with files. Existing functionality like editing a file, creating or uploading a file, and deleting a file or directory has been streamlined. You now have quick access to editing a file in github.dev or {% data variables.product.prodname_desktop %} and an integrated search-in-file function.
|
||||
|
||||
1. Select a repository, then click a file within that repository to open the new code view.
|
||||
1. To edit a file in the integrated file editor, click {% octicon "pencil" aria-label="The pencil icon" %}.
|
||||
1. To edit a file on the {% data variables.codespaces.serverless %} web-based editor or {% data variables.product.prodname_desktop %}, select {% octicon "triangle-down" aria-label="The downwards-facing triangle icon" %} next to {% octicon "pencil" aria-label="The pencil icon" %}, then click either **github.dev** or **{% data variables.product.prodname_desktop %}**.
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** The {% data variables.codespaces.serverless %} editor is currently in beta preview. You can provide feedback [in our discussions](https://github.com/community/community/discussions/categories/general).
|
||||
|
||||
{% endnote %}
|
||||
|
||||
1. To find specific characters within a file, view the raw code of the file by clicking the **Code** button. Next, press <kbd>Command</kbd>+<kbd>F</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>F</kbd> (Windows/Linux) and type the characters you want to find. You can navigate between results by pressing <kbd>Return</kbd> (Mac) or <kbd>Enter</kbd> (Windows/Linux), or by clicking {% octicon "chevron-down" aria-label="The downwards-facing chevron icon" %} and {% octicon "chevron-up" aria-label="The upwards-facing chevron icon" %}.
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** To use your browser's default find function, press <kbd>Command</kbd>+<kbd>F</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>F</kbd> (Windows/Linux) twice. Be aware that your browser's default find function will not be able to search the entirety of a large file, while the search integrated in the new code view will.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
1. To create a new file in a specific directory, navigate to the chosen directory. Next, select the **Add file** {% octicon "triangle-down" aria-label="The downwards-facing triangle icon" %} dropdown menu, then click {% octicon "plus" aria-label="The plus sign icon" %} **Create new file**.
|
||||
|
||||
Alternatively, you can click {% octicon "plus" aria-label="The plus sign icon" %} in the file tree view.
|
||||
1. To delete a directory or file, navigate to the directory or file and click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} . Then, click **Delete directory** or **Delete file**.
|
||||
1. To upload a file, navigate to the chosen directory. Next, select the **Add file** {% octicon "triangle-down" aria-label="The downwards-facing triangle icon" %} dropdown menu, then click {% octicon "upload" aria-label="The upload icon" %} **Upload files**.
|
||||
|
||||
Alternatively, you can drag and drop files into your browser.
|
||||
|
||||
## Using the symbols pane
|
||||
You can now quickly view and navigate between symbols such as functions or classes in your code with the symbols pane. You can search for a symbol in a single file, in all files in a repository, or even in all public repositories on {% data variables.product.prodname_dotcom %}.
|
||||
|
||||
Symbol search is a feature of the new code search (beta). For more information, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
|
||||
|
||||
1. Select a repository, then navigate to a file containing symbols.
|
||||
1. To bring up the symbols pane, above the file content, click {% octicon "code-square" aria-label="The code square icon" %}.
|
||||
|
||||
Alternatively, you can open the symbols pane by clicking an eligible symbol in your file. Clickable symbols are highlighted in yellow when you hover over them.
|
||||
|
||||
1. Click the symbol you would like to find from the symbols pane or within the file itself.
|
||||
|
||||
- To search for a symbol in the repository as a whole, in the symbols pane, click **Search for this symbol in this repository**. To search for a symbol in all repositories on {% data variables.product.prodname_dotcom %}, click **all repositories**.
|
||||
|
||||
1. To navigate between references to a symbol, click {% octicon "chevron-down" aria-label="The downwards-facing chevron icon" %} or {% octicon "chevron-up" aria-label="The upwards-facing chevron icon" %}.
|
||||
1. To navigate to a specific reference to a symbol, click a result of the symbol search under {% octicon "chevron-down" aria-label="The downwards-facing chevron icon" %} **In this file**.
|
||||
1. To exit the search for a specific symbol, click {% octicon "arrow-left" aria-label="The left arrow icon" %} **All Symbols**.
|
||||
|
||||
## Using the blame view
|
||||
Rather than losing file context when you enter the blame view, you can now use the new code view to quickly toggle between the blame view, the raw code view, and the preview for a file (depending on the file type).
|
||||
|
||||
1. Select a repository, then click a file within that repository to open the new code view.
|
||||
1. To see the revision history of the file, above the file content, click **Blame**. This view gives you a line-by-line revision history, with the code in a file separated by commit. Each commit lists the author, commit description, and commit date.
|
||||
- To see versions of a file before a particular commit, click {% octicon "versions" aria-label="View blame prior to this change" %}. Alternatively, to see more detail about a particular commit, click the commit message.
|
||||
|
||||

|
||||
|
||||
1. To return to the raw code view, above the file content, click **Code**.
|
||||
- If you are viewing a Markdown file, above the file content, you can also click **Preview** to return to the view with Markdown formatting applied.
|
||||
|
||||
## Further reading
|
||||
|
||||
- "[AUTOTITLE](/repositories/working-with-files/managing-files/moving-a-file-to-a-new-location)"
|
||||
- "[AUTOTITLE](/search-github/github-code-search/about-github-code-search)"
|
||||
@@ -33,7 +33,7 @@ Renaming a file also gives you the opportunity to [move the file to a new locati
|
||||
|
||||
1. In your repository, browse to the file you want to rename.
|
||||
{% data reusables.repositories.edit-file-button %}
|
||||
3. In the filename field, change the name of the file to the new filename you want. You can also update the contents of your file at the same time. {% ifversion fpt or ghec or ghes > 3.8 %}
|
||||
1. In the filename field, change the name of the file to the new filename you want. You can also update the contents of your file at the same time. {% ifversion fpt or ghec or ghes > 3.8 %}
|
||||
 {% elsif ghes < 3.9 or ghae %}
|
||||
 {% endif %}
|
||||
{% data reusables.files.write_commit_message %}
|
||||
|
||||
@@ -22,8 +22,8 @@ You can download the source code archives in three ways.
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. Above the list of files, click {% octicon "code" aria-hidden="true" %} **Code**.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
1. Click {% octicon "file-zip" aria-label="The ZIP icon" %} **Download ZIP**.
|
||||
|
||||
|
||||
@@ -49,6 +49,28 @@ To learn more about these approaches, see "[Precise and search-based navigation]
|
||||
|
||||
Future releases will add *precise code navigation* for more languages, which is a code navigation approach that can give more accurate results.
|
||||
|
||||
{% ifversion code-search-code-view %}You can use keyboard shortcuts to navigate within a code file. For more information, see "[AUTOTITLE](/get-started/using-github/keyboard-shortcuts#navigating-within-code-files)."{% endif %}
|
||||
|
||||
{% ifversion code-search-code-view %}
|
||||
## Using the symbols pane
|
||||
You can now quickly view and navigate between symbols such as functions or classes in your code with the symbols pane. You can search for a symbol in a single file, in all files in a repository, or even in all public repositories on {% data variables.product.prodname_dotcom %}.
|
||||
|
||||
Symbol search is a feature of code search. For more information, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
|
||||
|
||||
1. Select a repository, then navigate to a file containing symbols.
|
||||
1. To bring up the symbols pane, above the file content, click {% octicon "code-square" aria-label="The code square icon" %}.
|
||||
|
||||
Alternatively, you can open the symbols pane by clicking an eligible symbol in your file. Clickable symbols are highlighted in yellow when you hover over them.
|
||||
|
||||
1. Click the symbol you would like to find from the symbols pane or within the file itself.
|
||||
|
||||
- To search for a symbol in the repository as a whole, in the symbols pane, click **Search for this symbol in this repository**. To search for a symbol in all repositories on {% data variables.product.prodname_dotcom %}, click **all repositories**.
|
||||
|
||||
1. To navigate between references to a symbol, click {% octicon "chevron-down" aria-label="The downwards-facing chevron icon" %} or {% octicon "chevron-up" aria-label="The upwards-facing chevron icon" %}.
|
||||
1. To navigate to a specific reference to a symbol, click a result of the symbol search under {% octicon "chevron-down" aria-label="The downwards-facing chevron icon" %} **In this file**.
|
||||
1. To exit the search for a specific symbol, click {% octicon "arrow-left" aria-label="The left arrow icon" %} **All Symbols**.
|
||||
{% endif %}
|
||||
|
||||
## Jumping to the definition of a function or method
|
||||
|
||||
You can jump to a function or method's definition within the same repository by clicking the function or method call in a file.
|
||||
@@ -84,4 +106,4 @@ If code navigation is enabled for you but you don't see links to the definitions
|
||||
- Code navigation only works for repositories with fewer than 100,000 files.
|
||||
|
||||
## Further reading
|
||||
- "[AUTOTITLE](/search-github/searching-on-github/searching-code)"
|
||||
- "[AUTOTITLE]{% ifversion code-search-code-view %}(/search-github/github-code-search/about-github-code-search){% else %}(/search-github/searching-on-github/searching-code){% endif %}"
|
||||
|
||||
@@ -24,9 +24,15 @@ With the raw view, you can view or copy the raw content of a file without any st
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. Click the file that you want to view.
|
||||
1. In the upper-right corner of the file view, click **Raw**.
|
||||
{% ifversion code-search-code-view %}
|
||||
|
||||

|
||||
{% else %}
|
||||
|
||||

|
||||
{% endif %}
|
||||
1. Optionally, to copy the raw file content, in the upper-right corner of the file view, click **{% octicon "copy" aria-label="Copy raw content" %}**. {% ifversion code-search-code-view %} To download the raw file, click **{% octicon "download" aria-label="Download raw file" %}**.{% endif %}
|
||||
|
||||

|
||||
1. Optionally, to copy the raw file content, in the upper-right corner of the file view, click **{% octicon "copy" aria-label="Copy raw content" %}**.
|
||||
|
||||
## Viewing the line-by-line revision history for a file
|
||||
|
||||
@@ -40,11 +46,22 @@ Within the blame view, you can view the line-by-line revision history for an ent
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. Click to open the file whose line history you want to view.
|
||||
{% ifversion code-search-code-view %}
|
||||
1. Above the file content, click **Blame**. This view gives you a line-by-line revision history, with the code in a file separated by commit. Each commit lists the author, commit description, and commit date.
|
||||
1. To see versions of a file before a particular commit, click {% octicon "versions" aria-label="View blame prior to this change" %}. Alternatively, to see more detail about a particular commit, click the commit message.
|
||||
|
||||

|
||||
|
||||
1. To return to the raw code view, above the file content, click **Code**.
|
||||
- If you are viewing a Markdown file, above the file content, you can also click **Preview** to return to the view with Markdown formatting applied.
|
||||
{% else %}
|
||||
1. In the upper-right corner of the file view, click **Blame** to open the blame view.
|
||||

|
||||
|
||||

|
||||
1. To see earlier revisions of a specific line, or reblame, click {% octicon "versions" aria-label="View blame prior to this change" %} until you've found the changes you're interested in viewing.
|
||||
|
||||

|
||||

|
||||
{% endif %}
|
||||
|
||||
{% ifversion blame-ignore-revs %}
|
||||
|
||||
|
||||
@@ -19,28 +19,31 @@ topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% ifversion github-code-search %}
|
||||
{% note %}
|
||||
|
||||
**Note:** {% data reusables.search.classic-search-code-search-note %}
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
## About searching on {% data variables.product.prodname_dotcom %}
|
||||
|
||||
{% data reusables.search.you-can-search-globally %}
|
||||
|
||||
- To search globally across all of {% data variables.product.product_name %}, type what you're looking for into the search field at the top of any page, and choose "All {% data variables.product.prodname_dotcom %}" in the search drop-down menu.
|
||||
- To search globally across all of {% data variables.product.product_name %}, type what you're looking for into the search field at the top of any page, and choose "Search all of {% data variables.product.prodname_dotcom %}" in the search dropdown menu.
|
||||
- To search within a particular repository or organization, navigate to the repository or organization page, type what you're looking for into the search field at the top of the page, and press **Enter**.
|
||||
|
||||
{% ifversion code-search-code-view %} You can also use suggestions and completions in the search bar to quickly find what you need.
|
||||
|
||||
- If you click on the search bar in the top navigation of GitHub.com, you will see a list of suggestions organized by category, including recent searches and suggested repositories, teams, and projects that you have access to.
|
||||
- Clicking on any of the specific suggestions will take you directly to the page for that suggestion (for example, the repository or project page). If you click on a recent search, depending on the type of search, the search term will appear in the search bar or you will be taken to the search results page for the search term.
|
||||
- Once you start typing, you will see a list of completions and suggestions that match your query. You can click on a suggestion to jump to a specific location. As you continue to type, you will see more specific suggestions, such as code files you can jump to directly.
|
||||
|
||||
After typing a search query, you can press **Enter** to go to the full search results view, where you can see each match and a visual interface for applying filters. For more information, see "[Searching using a visual interface](#searching-using-a-visual-interface)."
|
||||
{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**Notes:**
|
||||
|
||||
{% ifversion fpt or ghes or ghec %}
|
||||
- {% data reusables.search.required_login %}{% endif %}
|
||||
- {% data variables.product.prodname_pages %} sites are not searchable on {% data variables.product.product_name %}. However you can search the source content if it exists in the default branch of a repository, using code search. For more information, see "[AUTOTITLE](/search-github/searching-on-github/searching-code)." For more information about {% data variables.product.prodname_pages %}, see "[AUTOTITLE](/pages/getting-started-with-github-pages/about-github-pages)"
|
||||
- Currently our search doesn't support exact matching.
|
||||
- Whenever you are searching in code files, only the first two results in each file will be returned.
|
||||
- {% data variables.product.prodname_pages %} sites are not searchable on {% data variables.product.product_name %}. However you can search the source content if it exists in the default branch of a repository, using code search. For more information, see "[AUTOTITLE]{% ifversion code-search-code-view %}(/search-github/github-code-search/understanding-github-code-search-syntax){% else %}(/search-github/searching-on-github/searching-code){% endif %}." For more information about {% data variables.product.prodname_pages %}, see "[AUTOTITLE](/pages/getting-started-with-github-pages/about-github-pages)"
|
||||
- Currently our search doesn't support exact matching.{% ifversion ghes or ghae %}
|
||||
- Whenever you are searching in code files, only the first two results in each file will be returned.{% endif %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -56,7 +59,7 @@ You can search for the following information across all repositories you can acc
|
||||
- [Topics](/search-github/searching-on-github/searching-topics)
|
||||
- [Issues and pull requests](/search-github/searching-on-github/searching-issues-and-pull-requests){% ifversion fpt or ghec %}
|
||||
- [Discussions](/search-github/searching-on-github/searching-discussions){% endif %}
|
||||
- [Code](/search-github/searching-on-github/searching-code)
|
||||
- {% ifversion code-search-code-view %}[Code](/search-github/github-code-search/understanding-github-code-search-syntax){% else %}[Code](/search-github/searching-on-github/searching-code){% endif %}
|
||||
- [Commits](/search-github/searching-on-github/searching-commits)
|
||||
- [Users](/search-github/searching-on-github/searching-users)
|
||||
- [Packages](/search-github/searching-on-github/searching-for-packages)
|
||||
@@ -64,7 +67,7 @@ You can search for the following information across all repositories you can acc
|
||||
|
||||
## Searching using a visual interface
|
||||
|
||||
You can search {% data variables.product.product_name %} using the {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}. {% ifversion command-palette %}Alternatively, you can use the interactive search in the {% data variables.product.prodname_command_palette %} to search your current location in the UI, a specific user, repository or organization, and globally across all of {% data variables.product.product_name %}, without leaving the keyboard. For more information, see "[AUTOTITLE](/get-started/using-github/github-command-palette)."{% endif %}
|
||||
In addition to the search bar, you can search {% data variables.product.product_name %} using the {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}. {% ifversion command-palette %}Alternatively, you can use the interactive search in the {% data variables.product.prodname_command_palette %} to search your current location in the UI, a specific user, repository or organization, and globally across all of {% data variables.product.product_name %}, without leaving the keyboard. For more information, see "[AUTOTITLE](/get-started/using-github/github-command-palette)."{% endif %}
|
||||
|
||||
The {% data variables.search.advanced_url %} provides a visual interface for constructing search queries. You can filter your searches by a variety of factors, such as the number of stars or number of forks a repository has. As you fill in the advanced search fields, your query will automatically be constructed in the top search bar.
|
||||
|
||||
|
||||
@@ -13,6 +13,15 @@ versions:
|
||||
topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% ifversion code-search-code-view %}
|
||||
{% note %}
|
||||
|
||||
**Note:** Sorting search results is not supported for {% data variables.product.product_name %} code search. For more information on code search, see "[AUTOTITLE](/search-github/github-code-search/about-github-code-search)."
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
Use the **Sort** dropdown menu to sort results by relevance, number of stars, number of forks, and how recently the items were updated.
|
||||
|
||||
To sort by interactions, reactions, author date, committer date, or how recently the items were updated, you can add a `sort` qualifier to your search query.
|
||||
|
||||
@@ -27,7 +27,7 @@ There are some limits to the length of the queries when searching across {% data
|
||||
* Queries longer than 256 characters are not supported
|
||||
* You can't construct a query using more than five `AND`, `OR`, or `NOT` operators
|
||||
|
||||
Specific search types, such as code search, might have additional limitations. Check the documentation for these search types for more information.
|
||||
Specific search types, such as code search, might have additional limitations. Check the documentation for these search types for more information. {% ifversion code-search-code-view %} For more information on code search limitations specifically, see "[AUTOTITLE](/search-github/github-code-search/about-github-code-search#limitations)."{% endif %}
|
||||
|
||||
## Further reading
|
||||
|
||||
|
||||
@@ -15,6 +15,15 @@ topics:
|
||||
- GitHub search
|
||||
shortTitle: Understand search syntax
|
||||
---
|
||||
|
||||
{% ifversion code-search-code-view %}
|
||||
{% note %}
|
||||
|
||||
**Note:** The syntax below applies to non-code search. For more information on code search syntax, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
## Query for values greater or less than another value
|
||||
|
||||
You can use `>`, `>=`, `<`, and `<=` to search for values that are greater than, greater than or equal to, less than, and less than or equal to another value.
|
||||
@@ -86,7 +95,7 @@ If your search query contains whitespace, you will need to surround it with quot
|
||||
* [cats NOT "hello world"](https://github.com/search?utf8=✓&q=cats+NOT+"hello+world"&type=Repositories) matches repositories with the word "cats" but not the words "hello world."
|
||||
* [build label:"bug fix"](https://github.com/search?utf8=%E2%9C%93&q=build+label%3A%22bug+fix%22&type=Issues) matches issues with the word "build" that have the label "bug fix."
|
||||
|
||||
Some non-alphanumeric symbols, such as spaces, are dropped from code search queries within quotation marks, so results can be unexpected.
|
||||
{% ifversion ghes or ghae %} Some non-alphanumeric symbols, such as spaces, are dropped from code search queries within quotation marks, so results can be unexpected.{% endif %}
|
||||
|
||||
## Queries with usernames
|
||||
|
||||
|
||||
@@ -1,38 +1,24 @@
|
||||
---
|
||||
title: About GitHub Code Search (beta)
|
||||
intro: 'You can search, navigate and understand code across GitHub with the new code search (beta).'
|
||||
title: About GitHub Code Search
|
||||
intro: 'You can search, navigate and understand code across {% data variables.product.prodname_dotcom %} with code search.'
|
||||
allowTitleToDifferFromFilename: true
|
||||
versions:
|
||||
feature: github-code-search
|
||||
feature: code-search-code-view
|
||||
topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% note %}
|
||||
## About {% data variables.product.prodname_dotcom %} code search
|
||||
|
||||
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
|
||||
{% data variables.product.prodname_dotcom %} code search lets you rapidly search, navigate and understand your code, your team's code, and the code of the open source community, all from {% data variables.product.prodname_dotcom_the_website %}. This search engine is designed to be scalable, code-aware, and support searching code across {% data variables.product.prodname_dotcom %} using regular expressions, boolean operations, specialized qualifiers, and symbol search. For more information on the syntax of code search, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
|
||||
|
||||
{% data reusables.search.code-view-link %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## About the new code search (beta)
|
||||
|
||||
The new code search (beta) lets you rapidly search, navigate and understand your code, your team's code, and the code of the open source community, all from {% data variables.product.prodname_dotcom_the_website %}. This search engine is designed to be scalable, code-aware, and support searching code across GitHub using regular expressions, boolean operations, specialized qualifiers, and symbol search. For more information on the syntax of the new code search (beta), see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
|
||||
|
||||
On top of the new code search engine, the code search (beta) includes new features in the search interface on {% data variables.product.prodname_dotcom_the_website %}, such as suggestions, completions, and the ability to save your searches. The new search interface allows you to more quickly and easily find what you are looking for. For more information, see "[AUTOTITLE](/search-github/github-code-search/using-github-code-search)."
|
||||
Code search is integrated with features in the search interface on {% data variables.product.prodname_dotcom_the_website %}, such as suggestions, completions, and the ability to save your searches. For more information, see "[AUTOTITLE](/search-github/github-code-search/using-github-code-search)."
|
||||
|
||||
{% data reusables.search.non-code-search-explanation %}
|
||||
|
||||
The new code search (beta) is tightly integrated with a redesigned code view (beta) on {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.search.code-view-link %}
|
||||
|
||||
## Enabling and disabling the new code search and code view (beta)
|
||||
|
||||
{% data reusables.search.enabling-and-disabling-code-search-and-view-beta %}
|
||||
|
||||
## Limitations
|
||||
|
||||
We have indexed many public repositories for the new code search (beta), and continue to index more. Additionally, the private repositories of GitHub users in the beta are indexed and searchable by beta participants that already have access to those private repositories on GitHub.com. However, very large repositories may not be indexed at this time, and not all code is indexed.
|
||||
We have indexed many public repositories for code search, and continue to index more. Additionally, the private repositories of {% data variables.product.prodname_dotcom%} users are indexed and searchable by those that already have access to those private repositories on {% data variables.product.prodname_dotcom_the_website %}. However, very large repositories may not be indexed at this time, and not all code is indexed.
|
||||
|
||||
The current limitations on indexed code are:
|
||||
- Vendored and generated code is excluded
|
||||
@@ -43,10 +29,10 @@ The current limitations on indexed code are:
|
||||
|
||||
We currently only support searching for code on the default branch of a repository.
|
||||
|
||||
Results for any search with the new code search (beta) are restricted to 100 results (10 pages). Sorting is not supported for code search results at this time. This limitation only applies to searching code with the new code search (beta) and does not apply to other types of searches.
|
||||
Results for any search with code search are restricted to 100 results (10 pages). Sorting is not supported for code search results at this time. This limitation only applies to searching code with the new code search and does not apply to other types of searches.
|
||||
|
||||
The new code search (beta) supports searching for symbol definitions in code, such as function or class definitions, using the `symbol:` qualifier. However, note that the `symbol:` qualifier only searches for definitions and not references, and not all symbol types or languages are fully supported yet. For a list of what languages are supported, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
|
||||
Code search supports searching for symbol definitions in code, such as function or class definitions, using the `symbol:` qualifier. However, note that the `symbol:` qualifier only searches for definitions and not references, and not all symbol types or languages are fully supported yet. For a list of what languages are supported, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
|
||||
|
||||
## Feedback and support
|
||||
|
||||
You can view and share feedback about the new code search (beta) in our [discussion forum](https://github.com/orgs/community/discussions/categories/code-search-and-navigation).
|
||||
You can view and share feedback about code search in our [discussion forum](https://github.com/orgs/community/discussions/categories/code-search-and-navigation).
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: GitHub Code Search (beta)
|
||||
title: GitHub Code Search
|
||||
intro: 'You can use a wide range of syntax to search {% data variables.product.product_name %}. You can adjust the scope of your search, build and troubleshoot queries, and narrow down search results with qualifiers.'
|
||||
allowTitleToDifferFromFilename: true
|
||||
versions:
|
||||
feature: github-code-search
|
||||
feature: code-search-code-view
|
||||
topics:
|
||||
- GitHub search
|
||||
children:
|
||||
@@ -11,11 +11,3 @@ children:
|
||||
- /using-github-code-search
|
||||
- /understanding-github-code-search-syntax
|
||||
---
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
|
||||
|
||||
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
---
|
||||
title: Understanding GitHub Code Search (beta) syntax
|
||||
title: Understanding GitHub Code Search syntax
|
||||
shortTitle: Code search syntax
|
||||
intro: 'You can build search queries for the results you want with specialized code qualifiers, regular expressions, and boolean operations.'
|
||||
allowTitleToDifferFromFilename: true
|
||||
versions:
|
||||
feature: github-code-search
|
||||
feature: code-search-code-view
|
||||
topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% note %}
|
||||
## About code search query structure
|
||||
|
||||
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
|
||||
The search syntax in this article only applies to searching code with {% data variables.product.prodname_dotcom %} code search. {% data reusables.search.non-code-search-explanation %}
|
||||
|
||||
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## About the new code search (beta) query structure
|
||||
|
||||
The search syntax in this article only applies to searching code with the new code search (beta) enabled. {% data reusables.search.non-code-search-explanation %}
|
||||
|
||||
Search queries consist of search terms, comprising text you want to search for, and qualifiers, which narrow down the search.
|
||||
Search queries consist of search terms, comprising text you want to search for, and qualifiers, which narrow down the search.
|
||||
|
||||
A bare term with no qualifiers will match either the content of a file or the file's path.
|
||||
|
||||
@@ -42,11 +35,11 @@ sparse index
|
||||
|
||||
The search results would include all documents containing both the terms `sparse` and `index`, in any order. As examples, it would match a file containing `SparseIndexVector`, a file with the phrase `index for sparse trees`, and even a file named `index.txt` that contains the term `sparse`.
|
||||
|
||||
Searching for multiple terms separated by whitespace is the equivalent to the search `hello AND world`. Other boolean operations, such as `hello OR world`, are also supported in the new code search (beta). For more information about boolean operations, see "[Using boolean operations](#using-boolean-operations)."
|
||||
Searching for multiple terms separated by whitespace is the equivalent to the search `hello AND world`. Other boolean operations, such as `hello OR world`, are also supported. For more information about boolean operations, see "[Using boolean operations](#using-boolean-operations)."
|
||||
|
||||
The new code search (beta) also supports searching for an exact string, including whitespace. For more information, see "[Query for an exact match](#query-for-an-exact-match)."
|
||||
Code search also supports searching for an exact string, including whitespace. For more information, see "[Query for an exact match](#query-for-an-exact-match)."
|
||||
|
||||
You can narrow your code search with specialized qualifiers, such as `repo:`, `language:` and `path:`. For more information on the qualifiers you can use in the new code search (beta), see "[Using qualifiers](#using-qualifiers)."
|
||||
You can narrow your code search with specialized qualifiers, such as `repo:`, `language:` and `path:`. For more information on the qualifiers you can use in code search, see "[Using qualifiers](#using-qualifiers)."
|
||||
|
||||
You can also use regular expressions in your searches by surrounding the expression in slashes. For more information on using regular expressions, see "[Using regular expressions](#using-regular-expressions)."
|
||||
|
||||
@@ -72,7 +65,7 @@ path: git language: "protocol buffers"
|
||||
|
||||
## Using boolean operations
|
||||
|
||||
The new code search (beta) supports boolean expressions. You can use the operators `AND`, `OR`, and `NOT` to combine search terms.
|
||||
Code search supports boolean expressions. You can use the operators `AND`, `OR`, and `NOT` to combine search terms.
|
||||
|
||||
By default, adjacent terms separated by whitespace are equivalent to using the `AND` operator. For example, the search query `sparse index` is the same as `sparse AND index`, meaning that the search results will include all documents containing both the terms `sparse` and `index`, in any order.
|
||||
|
||||
@@ -121,7 +114,7 @@ repo:github-linguist/linguist OR repo:tree-sitter/tree-sitter
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** The new code search beta does not currently support regular expressions or partial matching for repository names, so you will have to type the entire repository name (including the user prefix) for the `repo:` qualifier to work.
|
||||
**Note:** Code search does not currently support regular expressions or partial matching for repository names, so you will have to type the entire repository name (including the user prefix) for the `repo:` qualifier to work.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -141,7 +134,7 @@ user:octocat
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** The new code search beta does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work.
|
||||
**Note:** Code search does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
@@ -279,7 +272,7 @@ log4j NOT is:fork
|
||||
|
||||
## Using regular expressions
|
||||
|
||||
The new code search (beta) supports regular expressions to search for patterns in your code. You can use regular expressions in bare search terms as well as within many qualifiers, by surrounding the regex in slashes.
|
||||
Code search supports regular expressions to search for patterns in your code. You can use regular expressions in bare search terms as well as within many qualifiers, by surrounding the regex in slashes.
|
||||
|
||||
For example, to search for the regular expression `sparse.*index`, you would use:
|
||||
|
||||
|
||||
@@ -1,34 +1,24 @@
|
||||
---
|
||||
title: Using GitHub Code Search (beta)
|
||||
title: Using GitHub Code Search
|
||||
intro: 'You can use suggestions, completions and saved searches in the upgraded search interface to quickly find what you are looking for across {% data variables.product.prodname_dotcom_the_website %}.'
|
||||
allowTitleToDifferFromFilename: true
|
||||
versions:
|
||||
feature: github-code-search
|
||||
feature: code-search-code-view
|
||||
topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% note %}
|
||||
## About using {% data variables.product.prodname_dotcom%} code search
|
||||
|
||||
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
|
||||
|
||||
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## About using the new code search (beta)
|
||||
|
||||
Upon getting access to the new code search beta, GitHub will index any repositories you own and any repositories in organizations you are a member of, whether public, private, or internal. This means that you can search across all of your repositories, in addition to the public repositories on {% data variables.product.prodname_dotcom_the_website %} that have already been indexed. Only users with permission to view your code on {% data variables.product.prodname_dotcom_the_website %} will be able to see your code in search results. Forks are indexed and searchable in the same way as other repositories.
|
||||
{% data variables.product.prodname_dotcom %} indexes repositories you own and repositories in organizations you are a member of, whether public, private, or internal. This means that you can search across all of your repositories, in addition to the public repositories on {% data variables.product.prodname_dotcom_the_website %} that have already been indexed. Only users with permission to view your code on {% data variables.product.prodname_dotcom_the_website %} will be able to see your code in search results. Forks are indexed and searchable in the same way as other repositories.
|
||||
|
||||
Not all code is indexed, and you can currently only search the default branches of repositories. For more information on known limitations, see "[AUTOTITLE](/search-github/github-code-search/about-github-code-search#limitations)."
|
||||
|
||||
The new code search beta is integrated within the new code view beta. {% data reusables.search.code-view-link %}
|
||||
|
||||
## Using the search bar
|
||||
|
||||
On top of the new code search engine, the beta includes an upgraded search interface on {% data variables.product.prodname_dotcom_the_website %}. Using suggestions, completions, and saved searches, you can quickly find what you are looking for, often without having to fully type a query or view the search results page.
|
||||
You can search using the search interface on {% data variables.product.prodname_dotcom_the_website %}. Using suggestions, completions, and saved searches, you can quickly find what you are looking for, often without having to fully type a query or view the search results page.
|
||||
|
||||
For more information about the search syntax of the new code search (beta), see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
|
||||
For more information about the search syntax of code search, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
|
||||
|
||||
{% data reusables.search.non-code-search-explanation %}
|
||||
|
||||
@@ -56,8 +46,6 @@ For more information about the search syntax of the new code search (beta), see
|
||||
|
||||
## Using the search results view
|
||||
|
||||
The search results view already exists for the classic search on GitHub, and the functionality for most search types, except code, is the same. With the new code search beta enabled, the search results page has a redesigned UI and includes filters that are supported in the new code search engine, such as path and symbol filters.
|
||||
|
||||
To construct a search query, as well as view and filter results, using a visual interface, you can use the {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}. If you press Enter after typing a search query in the search bar, you will also be taken to the search results view.
|
||||
|
||||
On the search results view, you can navigate between different types of search results, including code, issues, pull request, repositories, and more. You can also view and use filters.
|
||||
|
||||
@@ -7,6 +7,7 @@ featuredLinks:
|
||||
startHere:
|
||||
- /search-github/searching-on-github/searching-issues-and-pull-requests
|
||||
- /search-github/searching-on-github/searching-code
|
||||
- /search-github/github-code-search/understanding-github-code-search-syntax
|
||||
- /search-github/searching-on-github/searching-for-repositories
|
||||
- /search-github/searching-on-github/searching-commits
|
||||
popular:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Finding files on GitHub
|
||||
intro: 'You can search for a file in a repository using the file finder. To search for a file in multiple repositories on {% data variables.product.product_name %}, use the [`filename` code search qualifier](/search-github/searching-on-github/searching-code#search-by-filename).'
|
||||
intro: 'You can search for a file in a repository using the file finder. To search for a file in multiple repositories on {% data variables.product.product_name %}, use the {% ifversion code-search-code-view %}[`path` code search qualifier](/search-github/github-code-search/understanding-github-code-search-syntax#path-qualifier){% else %}[`filename` code search qualifier](/search-github/searching-on-github/searching-code#search-by-filename){% endif %}.'
|
||||
redirect_from:
|
||||
- /articles/finding-files-on-github
|
||||
- /github/searching-for-information-on-github/finding-files-on-github
|
||||
@@ -17,19 +17,28 @@ topics:
|
||||
|
||||
**Tips:**
|
||||
|
||||
- By default, file finder results exclude some directories like `build`, `log`, `tmp`, and `vendor`. To search for files in these directories, use the [`filename` code search qualifier](/search-github/searching-on-github/searching-code#search-by-filename).{% ifversion file-finder-exclusion-controls %} Alternatively, you can customize which directories are excluded by default [using a `.gitattributes` file](#customizing-excluded-files).{% endif %}
|
||||
- By default, file finder results exclude some directories like `build`, `log`, `tmp`, and `vendor`. To search for files in these directories, {% ifversion code-search-code-view %}use the [`path` code search qualifier](/search-github/github-code-search/understanding-github-code-search-syntax#path-qualifier){% else %}use the [`filename` code search qualifier](/search-github/searching-on-github/searching-code#search-by-filename){% endif %}.{% ifversion file-finder-exclusion-controls %} Alternatively, you can customize which directories are excluded by default [using a `.gitattributes` file](#customizing-excluded-files).{% endif %}
|
||||
- You can also open the file finder by pressing `t` on your keyboard. For more information, see "[AUTOTITLE](/get-started/using-github/keyboard-shortcuts)."
|
||||
|
||||
{% endtip %}
|
||||
|
||||
## Using the file finder
|
||||
|
||||
{% ifversion code-search-code-view %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
2. Above the list of files, click **Go to file**.
|
||||

|
||||
3. In the search field, type the name of the file you'd like to find.
|
||||

|
||||
4. In the list of results, click the file you wanted to find.
|
||||
1. In the file tree view, click the {% octicon "filter" aria-hidden="true" %} **Jump to file** search bar. You can also find the {% octicon "filter" aria-hidden="true" %} **Jump to file** search bar at the top of the integrated file editor.
|
||||
|
||||

|
||||
1. In the search bar, type the name of the file or directory you'd like to find.
|
||||
1. In the list of results, click the file or directory you wanted to find. You can view the file path for a directory or file below each search result.
|
||||
{% else %}
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
1. Above the list of files, click **Go to file**.
|
||||

|
||||
1. In the search field, type the name of the file you'd like to find.
|
||||

|
||||
1. In the list of results, click the file you wanted to find.
|
||||
{% endif %}
|
||||
|
||||
{% ifversion file-finder-exclusion-controls %}
|
||||
|
||||
|
||||
@@ -8,22 +8,12 @@ redirect_from:
|
||||
- /github/searching-for-information-on-github/searching-code
|
||||
- /github/searching-for-information-on-github/searching-on-github/searching-code
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
topics:
|
||||
- GitHub search
|
||||
---
|
||||
|
||||
{% ifversion github-code-search %}
|
||||
{% note %}
|
||||
|
||||
**Note:** {% data reusables.search.classic-search-code-search-note %}
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.search.you-can-search-globally %} For more information, see "[AUTOTITLE](/search-github/getting-started-with-searching-on-github/about-searching-on-github)."
|
||||
|
||||
You can only search code using these code search qualifiers. Search qualifiers specifically for repositories, users, or commits, will not work when searching for code.
|
||||
|
||||
@@ -37,7 +37,7 @@ With the `in` qualifier you can restrict your search to the repository name, rep
|
||||
|
||||
You can find a repository by searching for content in the repository's README file using the `in:readme` qualifier. For more information, see "[AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes)."
|
||||
|
||||
Besides using `in:readme`, it's not possible to find repositories by searching for specific content within the repository. To search for a specific file or content within a repository, you can use the file finder or code-specific search qualifiers. For more information, see "[AUTOTITLE](/search-github/searching-on-github/finding-files-on-github)" and "[AUTOTITLE](/search-github/searching-on-github/searching-code)."
|
||||
Besides using `in:readme`, it's not possible to find repositories by searching for specific content within the repository. To search for a specific file or content within a repository, you can use the file finder or code-specific search qualifiers. For more information, see "[AUTOTITLE](/search-github/searching-on-github/finding-files-on-github)" and "[AUTOTITLE]{% ifversion code-search-code-view %}(/search-github/github-code-search/understanding-github-code-search-syntax){% else %}(/search-github/searching-on-github/searching-code){% endif %}."
|
||||
|
||||
| Qualifier | Example
|
||||
| ------------- | -------------
|
||||
|
||||
@@ -15,7 +15,7 @@ topics:
|
||||
---
|
||||
To show forks in [repository search](/search-github/searching-on-github/searching-for-repositories) results, add `fork:true` or `fork:only` to your query.
|
||||
|
||||
Forks are only indexed for [code search](/search-github/searching-on-github/searching-code) when they have more stars than the parent repository. You will not be able to search the code in a fork that has less stars than its parent. To show forks with more stars than the parent repository in code search results, add `fork:true` or `fork:only` to your query.
|
||||
{% ifversion ghes or ghae %}Forks are only indexed for [code search](/search-github/searching-on-github/searching-code) when they have more stars than the parent repository. You will not be able to search the code in a fork that has less stars than its parent. To show forks with more stars than the parent repository in code search results, add `fork:true` or `fork:only` to your query.{% endif%}
|
||||
|
||||
The `fork:true` qualifier finds all results that match your search query, including forks. The `fork:only` qualifier finds _only_ forks that match your search query.
|
||||
|
||||
|
||||
@@ -4,4 +4,3 @@
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>3.9'
|
||||
@@ -1,7 +0,0 @@
|
||||
# Reference for limited public beta: Issue #6669 — New Code View
|
||||
# Reference for public beta: #9287
|
||||
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>3.9'
|
||||
@@ -1,3 +1,9 @@
|
||||
1. Above the list of files, select the **Add file** dropdown, then click **Create new file**.
|
||||
{% ifversion code-search-code-view %}
|
||||
1. Above the list of files, select the **Add file** {% octicon "triangle-down" aria-label="The downwards-facing triangle icon" %} dropdown menu, then click {% octicon "plus" aria-label="The plus sign icon" %} **Create new file**.
|
||||
|
||||

|
||||
Alternatively, you can click {% octicon "plus" aria-label="The plus sign icon" %} in the file tree view on the left.
|
||||
|
||||

|
||||
{% else %}
|
||||
1. Above the list of files, using the **Add file** drop-down, click **Create new file**.
|
||||
{% endif %}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{%- ifversion fpt or ghec %}
|
||||
1. If you have more than one email address associated with your account on {% data variables.location.product_location %}, click the email address drop-down menu and select the email address to use as the Git author email address. Only verified email addresses appear in this drop-down menu. If you enabled email address privacy, then `<username>@users.noreply.github.com` is the default commit author email address. For more information, see "[AUTOTITLE](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address)."
|
||||

|
||||
|
||||

|
||||
{%- endif %}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
1. Below the commit message fields, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request. For more information, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)."
|
||||
|
||||

|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
{% ifversion code-search-code-view %}
|
||||
1. Above the new content, click **Preview**.
|
||||
|
||||

|
||||
{% else %}
|
||||
1. Above the new content, click **Preview changes**.
|
||||

|
||||
{% endif %}
|
||||
@@ -1 +1,2 @@
|
||||
1. Click **Commit changes** or **Propose changes**.
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
1. Click **Commit changes** or **Propose changes**.
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
{% ifversion code-search-code-view %}
|
||||
1. Click **Commit changes...**
|
||||
{% endif %}
|
||||
1. In the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. You can attribute the commit to more than one author in the commit message. For more information, see "[AUTOTITLE](/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors)."
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
1. Above the list of files, click {% octicon "code" aria-hidden="true" %} **Code**.
|
||||

|
||||
|
||||
1. Copy the URL for the repository.
|
||||
|
||||
- To clone the repository using HTTPS, under "HTTPS", click {% octicon "clippy" aria-label="Copy to clipboard" %}.
|
||||
- To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click **SSH**, then click {% octicon "clippy" aria-label="Copy to clipboard" %}.
|
||||
- To clone a repository using {% data variables.product.prodname_cli %}, click **{% data variables.product.prodname_cli %}**, then click {% octicon "copy" aria-label="Copy to clipboard" %}.
|
||||
|
||||
|
||||

|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
1. In the upper right corner of the file view, click {% octicon "pencil" aria-label="Edit file" %} to open the file editor.
|
||||
|
||||

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

|
||||
{% else %}
|
||||

|
||||
{% endif%}
|
||||
@@ -3,7 +3,7 @@
|
||||
{% ifversion githubdev-editor -%}
|
||||
{% note %}
|
||||
|
||||
**Note:** Instead of editing and committing the file using the default file editor, you can optionally choose to use the [github.dev code editor](/codespaces/the-githubdev-web-based-editor) by selecting the {% octicon "triangle-down" aria-label="More edit options" %} dropdown menu and clicking **Open in github.dev**.
|
||||
**Note:** Instead of editing and committing the file using the default file editor, you can optionally choose to use the [github.dev code editor](/codespaces/the-githubdev-web-based-editor) by selecting the {% octicon "triangle-down" aria-label="More edit options" %} dropdown menu and clicking **github.dev**. You can also clone the repository and edit the file locally via {% data variables.product.prodname_desktop %} by clicking **{% data variables.product.prodname_desktop %}**.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
{% ifversion code-search-code-view %}
|
||||
1. From the file tree view on the left, select the {% octicon "git-branch" aria-hidden="true" %} branch dropdown menu, then click **View all branches**. You can also find the branch dropdown menu at the top of the integrated file editor.
|
||||
|
||||

|
||||
{% else %}
|
||||
1. Above the list of files, click {% octicon "git-branch" aria-hidden="true" %} **Branches**.
|
||||
|
||||

|
||||
{% endif %}
|
||||
@@ -2,4 +2,4 @@
|
||||

|
||||
1. To clone and open the repository with {% data variables.product.prodname_desktop %}, click {% octicon "desktop-download" aria-hidden="true" %} **Open with {% data variables.product.prodname_desktop %}**.
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,3 +1 @@
|
||||
This article refers to the classic GitHub search experience. If you are participating in the new code search and code view beta and have enabled the new functionality, the syntax for searching code and the GitHub.com search interface will differ. However, the search syntax for non-code search types will stay the same.
|
||||
|
||||
For information about the new code search and code view, currently in public beta, see "[AUTOTITLE](/search-github/github-code-search/about-github-code-search)" and "[AUTOTITLE](/repositories/working-with-files/managing-files/navigating-files-with-the-new-code-view)."
|
||||
This article refers to the classic {% data variables.product.prodname_dotcom %} search experience. If you are participating in the new code search and code view beta and have enabled the new functionality, the syntax for searching code and the {% data variables.product.prodname_dotcom_the_website %} search interface will differ. However, the search syntax for non-code search types will stay the same.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
The new code search and code view are in public beta.
|
||||
@@ -1,4 +0,0 @@
|
||||
You can disable or enable the beta on {% data variables.product.prodname_dotcom_the_website %} anytime. Note that this setting applies to both the code search and the code view.
|
||||
|
||||
{% data reusables.feature-preview.feature-preview-setting %}
|
||||
1. To the right of "New Code Search and Code View (Beta)", click **Enable** or **Disable**.
|
||||
@@ -1 +1 @@
|
||||
Note that the syntax and qualifiers for searching for non-code content, such as issues, users, and discussions, work the same as before. For more information on non-code search, see "[AUTOTITLE](/search-github/getting-started-with-searching-on-github/about-searching-on-github)" and "[AUTOTITLE](/search-github/searching-on-github)."
|
||||
Note that the syntax and qualifiers for searching for non-code content, such as issues, users, and discussions, is not the same as the syntax for code search. For more information on non-code search, see "[AUTOTITLE](/search-github/getting-started-with-searching-on-github/about-searching-on-github)" and "[AUTOTITLE](/search-github/searching-on-github)."
|
||||
|
||||