Manage Files from the Git Page
If you’re a project member, you can browse, add, edit, rename, and delete a Git repository’s files. You can also view commit histories for the files but you can’t add or update files in a linked external Git repository.
You must be a project member to add or update a Git repository’s files:
-
In the left navigator, click Git
. -
From the Repositories drop-down list, select the Git repository. From the Revisions
drop-down list, select the branch. -
On the right side of the page, click Files, if necessary.
-
Browse and click a directory name to open it.
To go back to a file’s or a sub-directory’s parent directory, click / and select the file or directory from the menu. To go to the root directory, click
. To copy a file’s or a directory’s path, click Copy to clipboard
.
You can perform these file management tasks from the Git page:
| Action | How To |
|---|---|
|
Add a file |
To save the file to a new directory or a directory structure, include the file path in File Name. The path can be a relative path or an absolute path. To specify an absolute path, add a For example:
|
|
View a file's contents |
In the Git page, browse to and click the file name link to see its contents. The file opens in
File
tab:
If the text content exceeds the width of the editor, use the arrow keys to scroll left, right, up, and down. You can also use the scroll buttons to scroll horizontally. Move the cursor to the editor's left or right edge and click Right Scroll To view the file in raw (unformatted) format in the web browser, click Edit |
|
View a file's details |
The headers in the Files and Blame pages display the file size and number of lines of code (LOC) for each file. The tree view to the left indicates the file mode (whether a file is an executable, a symlink, a submodule, or a regular file) but only displays the file size for regular files. Icons show the file mode in the Files and Blame page's headers as well in the tree listing, so you can quickly see that a file is an executable, a symlink, or a submodule. Empty files, large files, and binaries are shown in a similar manner, where you see information about them, but not the contents of the files themselves. |
|
View a file's annotations and commits |
Open the file and click
Blame.
The Blame view displays the open file's annotations for each updated code line (or group of code lines) along with commit information. The annotation includes commits that affected code lines, the author, the commit's date-time stamp, and the commit message. |
| Show annotated tag messages | The Git page's Refs tab displays annotated tag messages. |
| Show a file's mode |
The diff view in the Git page's
Compare
tab displays the file mode.
Icons indicate the file mode in the File and Blame page's headers as well in the tree listing to the left so you can quickly see that a file is a regular file or an executable, a symlink, or a submodule (a gitlink) and, if it is a link, display information about the link's target. Empty files, large files, and binaries are shown in a similar manner, where you see information about them, but not necessarily the contents of the files themselves. |
| Change a file's mode |
If you change a file's mode, in the
Compare
tab, the comparison screen shows details about any mode changes or displays a "No diff" message if the mode wasn't changed. If you do change the mode, say from regular to executable, you're notified of the change with a message that says,
Mode change: Regular file->Executable file.
|
|
Edit, rename, or move a file |
Open the file and click
Edit
With the Git diff editor active, if you make a change in the file shown in the diff view, the view refreshes immediately. If you have another Files tab open (the editor in the Compare tab with the change isn't active), the diff info gets refreshed when you return to the tab it's in. The refresh happens as soon as you select the Compare tab. |
|
Delete a file |
To delete a file, click
Actions
When a file is deleted (or moved), any open diff editors associated with that file are closed. |