Skip to content

Setting up new branches for work with userstories and features

Document Creating branches and cloning
Author: Andreas Kjersheim
Version: 0.1
Date: 15.03.2024

Creating new branch

When we are starting work with a specific feature - the feature might have one or more userstories. Discuss the need, and create a branch based on either the feature or the userstory. For simplicity and documentation, as well as being easier able to point out issues, it might be handy to create 1 branch per userstory (Specially for UI changes).

Selecting-branches-creating-animation

Example of creating two usertories, one for each feature 106 and 112.

106

112

When you have your branches created, you can see them in the branch view, or from any location where they are visible:

See and select branches

You are now ready to start working in a branch. For the time being, I find the most practical way to clone this is to clone the project locally

clone create local folder see the repo

Viewing an instance of Tukko locally, to see your changes

To be able to run the app locally, you first need to install all the dependancies. If you open package.json you will see these. Although if you chose "View" -> "Open terminal", you can start installing.

Make sure you are navigated in the frontend or backend project - depending on where you want to work. You have either one of them cloned, if you followed the above.

Command to check where you are located: pwd

if you need to move around use cd foldername to go to a folder or cd .. to go one step back. Once you are at the path to the server you can perform the following

Command: npm install

Install dependancies

Once its all run, you might get information about outdated plugins or other issues, for example audit. In any case, check what is the issue if there are any and run the suggested commands. Make sure you check what it does beforehand.

Example if audit is needed

Run the app by starting for example npm build or npm dev:

Command: npm run dev

See and select branches

You can open - if it did not already automatically chose your default browser, and you should have the following result:

See and select branches

Oh no! I added a commit to the wrong branch! What to do?

If you started working, and added changes to a file, for example a simple update of the package.json that was done automatically.

When having VSC open, you might not notice - but in the bottom left corner it shows which branch you are currently in:

See VSC branch

If you have not noticed this when you initially made changes, and if you already ran one commit you might(hopefully) have noticed that "oh no- i am committing to the master branch! You can use the git reset head, and defining how many number of commits you have done and want to reset.

reset 1 commit

You now un-did your commit. The changes however are still in the file. If you for example click the file, you can see the changes:

reset 1 commit

You can use git stash to stash away your changes, switch branch - and then apply the stash to the new branch.

git stash, then changing branch(CLI or use the graphical interface), then applying the stash to that branch - and you are ready to continue:

reset 1 commit

At this point, you can see that you are in the right branch, and you can commit your updates. Do regular commits, do not do 2 hours of work and then commit all. Also remember - if multiple people are developing on the same repository - do not open or change files that you are not working on. And be very clear on which file exactly you are working on - at all times. We dont want to overwrite works other have struggled to complete.

reset 1 commit