Working with GitHub - Memory-Lane-COS301/miniproject-2023 GitHub Wiki

General Rules

  1. Do not commit anything to main/master unless widely discussed with others and everyone has agreed.
  2. If you have a merge conflict or any issue don't just delete, ask someone for help.

General Functionality

This document will look at both working with GitHub desktop and VScode (terminal and extension)\

GitHub Desktop

  1. Check that you are the correct repository in the top left.
  2. Check that you are in the correct branch
    • you can create a branch if you feel you need to, however ensure that the branch doesn't already exist.
    • when creating branches name correctly:
    • feature branches get feature/branchname
    • front end branches get front-end/branchname
    • etc etc
  3. If there are local changes to the branch pull them. (Big blue "pull" notification)
  4. Fetching origin will fetch any changes to the remote repo. (Won't download just checking if there are updates)
  5. Open in Vs Code (button in the middle)
  6. Once you have started coding:
    • you will be able to see any changes made in GitHub desktop
    • you can stash any changes in GitHub desktop (This means that the changes you've made will be saved and you can pull into your current branch)
    • once finished coding commit your work on GitHub desktop
    • you will need to supply a Summary heading and message when committing
    • ensure that your message isn't longer than 50 characters (the less the better), explain what and why.
  7. Push commits return\

VS Code/terminal

  1. Open the copied folder in vs code this should automatically activate git.
  2. If you have never done this before sign into your git account using either in the terminal:\
    • $ git config --global user.name "Your name here"\
    • $ git config --global user.email "user.email"
  3. Ensure that the source control in vs code(3rd icon from the top on the left) shows "message" and "commit".
  4. In the terminal type "git branch", the branch you are in will have a star next to it.
  5. If you are not in the branch that you should be working in then in the terminal type "git checkout 'branchname'".
  6. Ensure you're in the correct branch.
  7. If a branch you are looking for isn't there try "git fetch origin" and try again
  8. In the terminal type git status, if you are not up to date type "git pull"
  9. Once finished coding, your changes should show in the source control tab.
  10. You can stash, stage and commit your changes in the source control tab.
  11. vs code also provides an interface to view merge conflicts.

Merge conflicts

If you run into a merge conflict message and you don't understand the conflicts once viewing them,
contact the person who may be responsible for the changes (can be view in commit history) or contact the project manager.