How Can We Help?
< Back
You are here:
Print

Forking/Branching Workflow

Before beginning this procedure, it is a good idea to remove all copies of the repository from your computer. If you are concerned you might lose something, you can alternately move all copies of the repository to a backup location where they will not be confused with the working copy.

Setup

For this tutorial the ULB repository will be used as an example.

  1. Fork the ULB repository on DCS (https://git.door43.org/door43/en_ulb).
  2. Clone the official ULB repository to your computer.
    git clone -v --progress https://git.door43.org/Door43/en_ulb.git C:\Users\Phil\Projects\en_ulb
  3. Add your fork as a new remote named “myfork”.

Working

  1. Commit all changed files.
    git commit -am "Description of the change"
  2. Pull the latest master branch from DCS.
    1. Click “Pull”
    2. Check “Fetch from all remotes”
    3. Click “Pull”
      git fetch --all
      git pull
  3. Switch to the master branch if it is not already checked out.
    git checkout master
  4. Add a new branch.
    1. Select “Branch”
    2. Select “Add Branch”
    3. Type new branch name such as “working”
    4. Click “Add Branch & Checkout”
      git checkout -b working
    5. Right-click “myfork” in Branches pane
    6. Select “Push to”
    7. Select “myfork” in the Target Repository dropdown
    8. Click “Push”
      git push -u myfork working
  5. Make your changes. Note: you can add the new branch any time before the changes are committed.
  6. Commit changes to the new branch.
    git commit -am "Description of the change"
  7. Push the branch to “myfork” not “origin.”
    1. Right-click “myfork” in Branches pane
    2. Select “Push to”
    3. Click “Push”
      git push
  8. Create a Pull Request on DCS in the master ULB repository to merge your branch into the master branch.
    1. Switch to your fork on DCS in web browser
    2. Select “Pull Requests” tab
    3. Click “New Pull Request(?)”
    4. Add pull request message
    5. Click “Pull Request”
  9. Ask someone to review your Pull Request.
  10. The person who reviews and approves the Pull Request will merge it.
  11. Delete your branch, locally and from DCS, after it has been merged. This is not required, but it keeps the Branches pane free of clutter.
    1. Right-click on the branch name under “Local Branches” in the Branches pane. Do not delete the branch named “master.”
    2. Check both boxes in the dialog that pops up, “Delete tracked branch” and “Delete from remote.”
    3. Click the Delete button.
      git checkout master
      git branch -d working
      git push myfork --delete working
      git fetch --all
      git pull
Table of Contents