---
# System prepended metadata

title: Versionshanterings-guide
tags: [Dokumentation]

---

# Versionshanterings-guide

## Work Flow

### Working On New Feature

1. Make sure that you are on the master branch
```bash=
$ git branch
```
2. Pull the latest changes
```bash=
$ git pull
```
3. Create a new branch
```bash=
$ git branch 'branch-name'
```
4. Change branch to the new branch
```bash=
$ git checkout BRANCH_NAME
```
5. Implement the feature.
6. After the implementation is done:
```bash=
$ git add .
$ git commit -m 'my commit message'
```
7. Change back to master and pull latest changes
```bash=
$ git checkout master
$ git pull
```
8. Change back to your branch
```bash=
$ git checkout BRANCH_NAME
```
9. Merge with master
```bash=
$ git merge master
```
10. IF conflict Resolve conflict in editor and go to next step
11. ELSE
```bash=
$ git push origin BRANCH_NAME
```
12. Go to merge request page of the repo and press "Create merge request"
![](https://i.imgur.com/auZgopE.png)

13. Scroll down and press "Create merge request"(Make sure that "Delete source branch when merge request is accepted." is checked)

![](https://i.imgur.com/C4tYVqo.png)

14. If everything went ok, scroll down and press the "Merge" button
![](https://i.imgur.com/32mWM4S.png)

15. Go back to the terminal and change back to the master branch and pull the latest changes
```bash=
$ git checkout master
$ git pull
```
16. Delete the feature branch
```bash=
$ git branch -d BRANCH_NAME
```
17. REPEAT

## Commands

- Show branches
    - git branch
- Create new branch
    - git branch 'branch-name'
- Select branch
    - git checkout BRANCH-NAME
- Delete branch
    - git branch -d BRANCH-NAME

###### tags: `Dokumentation`
