Working in a pull request in SourceCraft

To work with pull requests in SourceCraft, including for approvals, you do not need to switch to an IDE on your local computer: you can do all the steps in the SourceCraft interface. You can navigate and search through the project code and edit the code.

Once a pull request is created and published, you can:

Creating a new iteration

Once a pull request is created, each push of changes to a remote repository branch creates a new iteration. This iteration includes all commits made before the git push command was executed.

To create a new iteration:

  1. In the same branch the pull request was created from, make new changes to the repository files.

  2. Add the modified files to the git index, commit, and push the changes to the remote repository:

    git add .
    git commit -m "<comment_to_commit>"
    git push origin <branch_name>
    

    Your iterations will register all previous changes, even if new commits were sent using the git push --force command.

    Note

    You can perform multiple commits and then push the changes to the remote repository. All of them will be included into one iteration.

  3. After you create a new iteration, the pull request gets the draft status. Publish it again.

You can make changes to the branch and create a new iteration directly in the SourceCraft interface.

Viewing changes made to the target branch

  1. Open the SourceCraft home page.
  2. On the Home tab, navigate to Repositories.
  3. Select a repository.
  4. Under Code on the repository page, navigate to Pull requests.
  5. Select a pull request.
  6. View the contents of the pull request:
    • The Overview tab displays the history of its iterations. To view the changes from a specific iteration, click Show changes next to that iteration.

    • The Files changed tab displays the modified files in the repository.

      • To compare changes between iterations, select them from the drop-down lists in the Compare field.

      • To display the file structure, click next to the drop-down lists for branch and iteration comparison.

        For more information, see Navigating and searching by code in SourceCraft.

    • The Commits tab displays all commits for all iterations of the pull request.

Leaving a comment and requesting changes

  1. Open the SourceCraft home page.

  2. On the Home tab, navigate to Repositories.

  3. Select a repository.

  4. Under Code on the repository page, navigate to Pull requests.

  5. Select a pull request.

  6. Leave a comment:

    Enter your comment in the Activity section on the Overview tab.

    1. On the Files changed tab, click next to the row you want to comment on.
    2. In the window that opens, enter your comment.
  7. Optionally, select Change request to request changes to the pull request.

  8. Click Comment.

    You can also save your comment as a draft to modify it later instead of publishing it right away. To do this, click Draft.

Passing a resolution

  1. Open the SourceCraft home page.
  2. On the Home tab, navigate to Repositories.
  3. Select a repository.
  4. Under Code on the repository page, navigate to Pull requests.
  5. Select a pull request.
  6. In the top-right corner, click next to Approve.
  7. Select a resolution:
    • Approve: Approve the current pull request iteration. Once you modify the pull request, you will need to get the resolution again.
    • Trust: Approve the current and all subsequent pull request iterations.
    • Block merge: Prohibit merging changes from the pull request into the target branch.

Merging with the target branch

Once the pull request is approved, you can perform a merge with the target branch.

  1. Open the SourceCraft home page.
  2. On the Home tab, navigate to Repositories.
  3. Select a repository.
  4. Under Code on the repository page, navigate to Pull requests.
  5. Select a pull request.
  6. In the top-right corner, click next to Merge pull request.
  7. Select the method of merging with the target branch:
    • Create a merge commit: Separate merge commit is created in the target branch, which saves the revision history of both branches. This gives you a clear idea of when and how the merge had taken place, while keeping the full development history unchanged.
    • Squash and merge: Before merging with the target branch, commits from the branch with changes are combined into a single commit. This helps maintain a cleaner and simpler revision history by reducing a series of small commits to a single one.
    • Rebase and merge: Commits from the branch with changes are joined to the main branch without creating a special merge commit. This moves commits from the branch with changes to the end of the target branch, preserving a linear revision history.
  8. In the top-right corner, click with the merge method you selected.

Rejecting a pull request

  1. Open the SourceCraft home page.
  2. On the Home tab, navigate to Repositories.
  3. Select a repository.
  4. Under Code on the repository page, navigate to Pull requests.
  5. Select a pull request.
  6. In the top-right corner, click and select Discard pull request.

See also