Skip to content

Gitguide

bjornenalfa edited this page Feb 20, 2018 · 1 revision

Workflow

Every task/feature should have its own branch from master. When the task/feature is done a pull request should be created. The pull request can be accepted after it has passed tests and been reviewed by another contributor.

Setup

Clone the repository onto your own machine. This can be done through HTTPS or SSH.
HTTPS:
git clone https://github.com/TDDD96-PUM-Grupp1/controller.git
SSH:
git clone [email protected]:TDDD96-PUM-Grupp1/controller.git

After cloning you should navigate into the new folder and set up your git config.
git config user.name "Xxx Yyy"
git config user.email [email protected]

Branching from master

First switch to the master branch using git checkout master and make sure you have the latest version using git pull then create a new branch and switch to it. A good name for the branch is something describing the feature you are working on.
git checkout -b BRANCH

Committing your changes

First add your changes, either directly using git add filepath or all changed/untracked files using git add -A. But before using -A make sure to check with git status so that you don't add incorrect files. You can prevent those from being added by updating the .gitignore file.

When you have added your files it is time to make a commit. Write a short and concise message describing the changes/feature added in the commit.
git commit -m "MESSAGE"

Working

It is a good idea to push your commits to the remote repository so that your changes are backed up.
git push -u origin BRANCH
After the first time you can simply push using git push.

While working on your branch you should make sure to keep it up to date with the master branch.
git pull origin master

Clone this wiki locally