Setting up Git Repository

Setting up an organization
  1. Press the '+' on the navbar in GitHub.

    GitHub Navbar
  2. Click on "New organization".

    GitHub Dropdown Organization
  3. Press “Join for Free”.

  4. Enter information about your organization.

    1. “Organization account name” is the Organization name, which you can enter whatever you like. If there is an error with it (for example an organization with the name exists) it will notify you.

    2. “Contact email” should be the organization email or the person who is setting up the organization.

    3. “This organization belongs to” can be a personal or A business, but for this tutorial we will clock on “My personal account.”
  5. (Optional) To invite people to the organization you can add their username, profile name, or email address.

  6. Fill out the quick survey about the organization

  7. You’re done! The organization is set up and is ready to have repos made to it.

Making repositories for the organization
  1. Press the ‘+’ on the navbar in GitHub.

    GitHub Navbar
  2. Press on “New repository”.

    GitHub Dropdown Repository
  3. Click on section under “Owner” (It will have your username) and change it to your organization.

  4. From there make the repository like you normally would.

    1. Make sure to have a README.md enabled.
  5. You don’t need to invite your organization members as collaborators since an invite it already sent to all organization members.

Branching

By default, there should always be a master and a staging branch. The master will be what the public sees when they access a site and staging branch will be used for local view to test out new features.

Making a master and staging branch
  1. Click on the “Main” branch and add a new branch called “staging.”
  2. After making a repo go to the “Security” tab.
  3. Press on the “Branches” section.
  4. Under the “Default branch” section press on the pen to the right of “main” branch. Default Branch in Github
  5. Rename the “main” branch to “master” and confirm.
  6. You will be redirected to the branches page and from there click on the two arrows pointing towards the opposite direction. Branches in GitHub
  7. Press on the same arrow again, but now in the branches section in the “Settings” tab. Default Branch in Github
  8. Click on “master”, change it to “staging”, and click “Update.”
  9. Done! You have made a master and staging branch

Merge Conflict

A merge conflict will occur when two users are trying to edit the same part of a file. For example both people editing a CSS class.

A merge error will occur when someone who pulled from the staging branch at an earlier date is trying to merge to the staging branch after another branch was merged to it at a later date.

In this example, I merged a newer branch into the staging branch and now the older “merge” branch is having a problem with merging into the “staging” branch due to new changes that it did not expect.

Merge Conflict

Resolving Merge Conflict

In this tutorial I will also be using Visual Studio Code to fix the merge error.

  1. Check out the current branch you are merging, in this case it will be the “merge” branch.
  2. Open the “Source control” tab.
  3. Expand the “Branches” section.
  4. Switch over to the “merge” branch.
  5. Open a new terminal with (Ctrl+Shift+`).
  6. Type in “git merge staging”.
  7. You’ll be prompted with a “CONFLICT (content): Merge conflict in file_name”.
  8. You’ll be shown the content from the “HEAD” branch and the branch you’re trying to merge to. Keep the changes you need.
  9. Commit & Push the changes and return to your pull request.
  10. From there you’ll be told “This branch has no conflicts with the base branch” and you can merge the pull request