Help Center/ CodeArts Repo/ User Guide/ Old Version/ Cloud Repositories/ Managing Repository Files in Console
Updated on 2023-07-25 GMT+08:00

Managing Repository Files in Console

Introduction

CodeHub allows you to edit, trace, and compare file.

When you access the repository details page, the Files tab page is displayed by default. You can switch to different branches and tags to view the files in the corresponding version. The file list is displayed on the left, and the repository name (the tab name is the name of the displayed file), History tabs are displayed on the right.

File List

The file list is displayed on the left of the Files tab of the repository details page.

The file list provides the following functions:

  • Switching branches and tags to display the file directory of the corresponding version

  • Click to display the search box. You can search for files in the file list.
  • Click provides the following functions:
  • Point to the name of a file. The button for renaming the file is displayed.
  • Click a file name to display the file content on the repository name tab page on the right. On this tab page, you can modify the file content and trace file changes.

    : file

    : folder

    : Git submodule

Creating a File

Creating a file on the CodeHub console is to create a file and run the add, commit, and push commands. A commit record is generated.

The created file is added to the file list of the corresponding branch. You can view the commit remarks and details on the repository name tab page.

Procedure:

  1. Access the repository list page.
  2. Go to your repository. (If there is no repository, create one.)
  3. Click next to the branch and choose Create File. The Create File area is displayed. (Note that this step is to create a file under the branch.)

    Click next to the folder and choose Create File. The Create File area is displayed. (Note that this step is to create a file in a folder under the branch.)

  4. On the Create File page, enter related information as prompted.

    Commit Message is equivalent to the -m message in the git commit command and can be used for associating work items. For details, see Associating Work Items.

  5. Click OK to save the new file.

Creating a Directory

Creating a directory on the CodeHub console is to create a folder structure, and run the add, commit, and push commands. A commit record is generated.

The created directory structure (folder structure) is added to the file list of the corresponding branch. You can view the commit remarks and details of each layer on the repository name tab page.

A .gitkeep file is created at the bottom of the directory by default because Git does not allow a commit of an empty folder.

Procedure:

  1. Access the repository list page.
  2. Go to your repository. (If there is no repository, create one.)
  3. Click next to the branch and choose Create Directory. The Create Directory area is displayed. (Note that this step is to create a directory under the branch.)

    Click next to the folder and choose Create Directory. The Create Directory area is displayed. (Note that this step is to create a directory in a folder under the branch.)

  4. In the Create Directory dialog box, enter related information as prompted.

    • Directories are divided into different levels by slashes (/).
    • Commit Message is equivalent to the -m message in the git commit command and can be used for associating work items. For details, see Associating Work Items.

  5. Click OK to save the new directory structure.

Uploading a File

Uploading a file on the CodeHub console is to create a file and run the add, commit, and push commands. A commit record is generated.

Procedure:

  1. Access the repository list page.
  2. Go to your repository. (If there is no repository, create one.)
  3. Click next to the branch and choose Upload File. The Upload File area is displayed. (Note that this step is to upload a file under the branch.)

    Click next to the folder and choose Upload File. The Upload File area is displayed. (Note that this step is to upload a file in a folder under the branch.)

  4. In the Upload File dialog box, enter related information as prompted.

    • All file formats are supported. Only one file can be uploaded at a time. The size of a file cannot exceed 10 MB. If the file size exceeds 10 MB, use the Git client to push the file.
    • Commit Message is equivalent to the -m message in the git commit command and can be used for associating work items. For details, see Associating Work Items.

  5. Click OK to upload the file.

The uploaded file is added to the file list of the corresponding branch. You can view the commit remarks and details of each layer on the repository name tab page.

Renaming a File

Renaming a file on the CodeHub console is to change a file name, and run the add, commit, and push commands. A commit record is generated.

Procedure:

  1. Access the repository list page.
  2. Go to your repository. (If there is no repository, create one.)
  3. Point to a file in the file list on the left and click . The Rename File dialog box is displayed.
  4. In the Rename File dialog box, change the file name and enter the commit message.

    Commit Message is equivalent to the -m message in the git commit command and can be used for associating work items. For details, see Associating Work Items.

  5. Click OK to change the file name.

Viewing Repository Details on the Repository Name Tab Page

By default, the repository name tab page displays repository details.

It displays the following information:

  • File: name of a file or folder.
  • Update time: last update time of the file or folder.
  • Creator: creator of the last commit to the file or folder.
  • Commit message: message of the last commit to the file or folder (-m in the commit command). You can click the message to display the commit record.

Commit messages are required for the edit and delete operations. They are similar to -m in the git commit command and can be used for associating work items. For details, see Associating Work Items.

Viewing Commit History of a Repository on the History Tab Page

The History tab page displays the commit history of a repository.

On this page, you can perform the following operations on the commit history:

  • Click a Commit Name to go to the commit details page.
  • Click to display the following extended functions:
    • Create Branch.
    • Create Tag:Tag this commit. (What is tag?).
    • Cherry-Pick: Use the commit as the latest commit to overwrite a branch. It is used to retrieve a version.
    • Revert: undoing this commit
    • Commit Records: View commit records.

Viewing File Details on the File Name Tab Page

By default, the file name tab page displays file details.

Table 1 Screen description

Screen Function

Function Description

File

Name of the file.

Updated

Last update time of the file.

Creator

Creator of the last commit to the file.

Full-Screen

Full screen to view the file content.

Copy Code

Copy the file content to the clipboard.

Download

Download the file to the local computer.

Edit

Edit the file online.

Delete

Delete the file.

Viewing Commit History of a File on the History Tab Page

The History tab page displays the commit history of a file.

On this page, you can perform the following operations on the commit history:

  • Click a Commit Name to go to the commit details page.
  • Click to display the following extended functions:
    • Create Branch.
    • Create Tag: Tag this commit. (What is Tag?).
    • Cherry-Pick: Use the commit as the latest commit to overwrite a branch. It is used to retrieve a version.
    • Revert: undoing this commit.
    • Commit Records: View commit records.

Viewing and Tracing File Change History on the Blame Tab Page

The Blame tab page is located in the file details area. Click the target file. The following figure is displayed.

On this tab page, a modifier corresponds to their modified content. You can click the file name to view the commit details.

Comparison: Shows Commit Differences

The Comparison tab page is located in the file details area. Click the target file. The following figure is displayed. You can select different commits to compare differences.

CodeHub displays differences better than the Git Bash client.

The comparison result shows the impact of merging from the left repository version to the right repository version on the files in the right repository. If you want to know the differences between the two file versions, you can adjust the left and right positions, compare them again, and learn all the differences based on the two results.