[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-10。"],[],[],null,["# Git source editor\n\nOverview\n--------\n\n[Git source editor](https://ci.android.com/edit) (ci.android.com/edit) is a\nbrowser-based tool for editing files in the Android Open Source Project (AOSP)\nand uploading changes to Gerrit. It's intended for making minor changes to a\nsmall number of files, and provides a faster workflow than\n[downloading the Android source tree](/setup/build/downloading).\nYou should be familiar with the full process of submitting changes to AOSP using\nGit, Repo, and Gerrit before using Git source editor.\n\nWhen you edit a file using Git source editor, all of the work happens on your\nlocal machine, until you upload changes to create a Gerrit changelist.\n| **Caution:** Because changes are stored only in the browser, they're lost if you refresh or close the browser tab before uploading them.\n\nLog in\n------\n\n1. Load [Git Source Editor](https://ci.android.com/edit) in a browser.\n2. Click **Log in** to log in to your account.\n\n | **Note:** Make sure to log in with the account that has Gerrit privileges for the branches you want to edit.\n\n **Figure 1.** Login button\n\nEdit files and changes\n----------------------\n\nGit Source Editor has these main workflows:\n\n- Edit one or more files of your choice, in the branch that you choose.\n- Edit a change. When you edit a change, the result depends on who created the change:\n - If you created the change, your Git Source Editor edits get patched into the change as a new patchset.\n - If someone else created the change, your Git Source Editor edits create a new change that you own, based on the change you loaded.\n\n### Load what you want to edit\n\nStart an editing session by loading either a file or a change.\n\n#### Load files\n\n1. Enter the URL of the file you want to edit in the **file/change path** box\n at the top of the page.\n\n Sample file path:\n https://android.googlesource.com/platform/build/+show/refs/heads/android16-release/Changes.md\n2. Click **Load file or change**.\n\n **Figure 2.** Loading a file or change\n\n The file loads in the editor pane. The navigation pane to the left of the\n editor pane is a file browser, which opens the repo, with your file\n preloaded.\n\n **Figure 3.** A file loaded into the editing pane\n\n| **Note:** Be sure to follow the remaining steps to submit your CL before refreshing or closing your browser tab. Because the edited files are stored on your local machine, refreshing or closing your browser tab here loses any changes you made.\n\nYou can use the navigation pane to open more files within the same repo. If you\nopen multiple files, each file appears as a tab in the row above the editing\npane. Click a tab to open that file in the editing pane.\n\n**Figure 4.** Tabs for loaded files\n\n#### Load a change\n\nNavigate to the change you want to edit by entering the URL of a Gerrit\nchangelist into the **file/change path** box at the top of the page (see\nFigure 2).\n\nSample change link:\nhttps://android-review.googlesource.com/c/platform/build/soong/+/1284176\n\nThe files in the change open in the editing pane (see Figure 3).\n\nIf the change includes multiple files, each file appears as a tab in the row\nabove the editing pane (see Figure 4). Click a tab to open that file in the\nediting pane.\n| **Note:** Be sure to follow the remaining steps to submit your CL before refreshing or closing your browser tab. Because the edited files are stored on your local machine, refreshing or closing your browser tab here loses any changes you made.\n\n### Make your edits\n\nEdit files using the text editing pane. Files you edit appear in the Pending\nchanges list below the editing pane. If you accidentally close the tab of a file\nwith edits, you can reopen the file with the edits intact by clicking its name\nin the Pending changes list.\n\nSubmit changes\n--------------\n\nYou create and publish your change to Gerrit in Git Source Editor. Then you\ntrack the change's approval in Gerrit.\n\n### Create and publish the changes\n\nFollow this procedure to create and publish the changes you've made.\n\n1. Click the appropriate button:\n\n - Click **Create change** if you're creating a new change.\n - Click **Update change** if you are updating an existing change.\n\n A dialog box opens.\n\n **Figure 5.** Create Change dialog box\n2. Enter a change description, which will become the change description in\n Gerrit. This description is required. If you are editing an existing change,\n you can edit its description if you want.\n\n3. Optionally, clear or select the **Publish on create** checkbox.\n\n This box is selected by default.\n\n If this box is selected when you create the change, the change is\n immediately published to Gerrit. If the box isn't selected, the change is\n uploaded to Gerrit but not published.\n4. Click **Create**.\n\n The change is uploaded to Gerrit. If you selected the **Publish on create**\n checkbox, the change is also published in Gerrit. The change is linked in a\n notification at the top of the screen.\n\n **Figure 6.** Change created notification\n\n### Track change approval in Gerrit\n\nTrack change submission status directly in Gerrit, as you would any other\nchange.\n\n**Figure 7.** Tracking change submission status in Gerrit\n\nView file diffs\n---------------\n\nSelect the **Diff** checkbox below the editing pane to view the diffs of edits\nyou've made to the file that's active in the editing pane. This is useful when\nchanging a file and when editing an existing change.\n\n**Figure 8.** Viewing file diffs\n\nRevert files\n------------\n\nYou can revert changes from a single file or from all the files in the pending\nchangelist. Both revert options revert changes only in Git Source Editor. They\nwill NOT update the change in Gerrit.\n\n### Revert a single file\n\nTo revert a single file, click the **X** next to the filename in the Pending\nchanges list.\n\n**Figure 9.** Pending changes section\n\n### Revert all files\n\nTo revert all files at once, click **Revert all files** below the editing pane.\n\n**Figure 10.** Revert all files button\n\nA popup dialog box opens. Click **Revert all** to revert changes in\nall pending files, or click **Cancel** to retain the changes and continue\nediting.\n\n**Figure 11.** Revert all files confirmation dialog box\n\nEdit a page directly from Android code search\n---------------------------------------------\n\nYou can open a file in Git Source Editor directly from\n[Android code search](/docs/setup/contribute/code-search). This is helpful if you\nneed to locate the file before editing it.\n\nFollow this procedure to edit a file directly from Android code search.\n\n1. In Android Code Search (cs.android.com), navigate to the file you are\n interested in editing.\n\n2. Click **Edit code**.\n\n **Figure 12.** Android Code Search **Edit code** button\n\n Git Source Editor opens with the file preselected for editing.\n3. Select the Git branch in which you want to edit the file from the **Select a\n git branch** dropdown list, then click **Pick branch**.\n\n **Figure 13.** Selecting a Git branch to edit\n\n The file opens in the editing pane.\n4. Continue editing as described in the [Making Your Edits](#making-your-edits)\n section.\n\n5. You can open additional files to edit as described in the\n [Loading files](#loading-files) section\n\nResolve conflicts\n-----------------\n\nTo resolve conflicts:\n\n1. In the Source Editor, navigate to the change. After the change is loaded,\n the conflicting files are listed in the bottom portion of the screen.\n For example, Figure 14 shows that the`Android.pb` file has a conflict.\n\n **Figure 14.** Source editor conflict\n2. Click a conflicting file. The file loads and shows conflicting blocks of\n content in succession and within Git markers (`\u003c\u003c\u003c\u003c\u003c\u003c\u003c` and `\u003e\u003e\u003e\u003e\u003e\u003e\u003e`).\n\n **Figure 15.** Source editor conflict markers\n3. Fix the conflict by editing the file and manually removing the conflict\n markers around the content you want to keep. Also, remove the content and\n conflict markers for content you don't want to keep.\n\n4. Click **Create Change** to create a new change. The Create Change\n dialog appears.\n\n **Figure 16.** Create change\n5. Type a change description and click **Create**.\n\nSend feedback\n-------------\n\nUse the bug button\n\nin the top right corner to provide feedback about Git Source Editor.\n\nRelated documentation\n---------------------\n\n- [Android code search](/setup/contribute/code-search)"]]