Forking a Code Repository
You can fork the code repository to create a copy in any DevOps project in the same tenancy, add or remove files, commit changes, and work on different branches by using Git operations.
Before you fork a code repository, you must have a code repository.
For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.
- Open the navigation menu and click Developer Services. Under DevOps, click Projects.
- Select a project and from the left-side menu, click Code Repositories.
- Select a code repository, and then click the Create Fork button on the Repository details page.
- Select a compartment for the forked repository.
- Select a DevOps project.
- Enter a unique name for the repository.
- Click Create.
 - The forked repository details are displayed that includes link to the parent repository and the default branch. The forked repository can be forked again. - You can perform the following actions on the forked repository: - Synchronize the forked repository.
- Create pull request.
- Clone the repository.
- Compare parent and forked repository: To compare file changes and commit changes between any two branches belonging to the same repository or the parent repository, click Compare. Choose a source and target repository. Select the associated source and target branch to compare. The highlighted file changes and commit details are displayed. The changes can be viewed inline or side-by-side.
 
- To create a forked repository, run the - createcommand:- oci devops repository create- Required parameters are: - --name
- --project-id
- --repository-type FORKED
- --parent-repository-id
- -repository-id
- source-repository-id
 - To compare fork branch with the parent branch run the - get-commit-diffcommand:- oci devops repository get-commit-diff- Required parameters are: - -repository-id
- --target-version
- --target-repository-id.
 - To check fork branch sync status run the - list-fork-sync-statusescommand:- oci devops repository list-fork-sync-statuses- Required parameters are: - --branch-name-query-param
- --repository-id
 - To create pull request from fork repository to parent repository run the - createcommand:- oci devops pull-request create- Required parameters are: - --display-name
- --repository-id
- --source-branch
- --destination-branch
- --reviewers
- --source-repository-id
 - To get all the commands for - repository:- oci devops repository -h
- To fork a code repository, use the - CreateRepositoryoperation.