A step by step of our git workflow!
cd [directory] —> cd phase-2
My phase-2 repo folder is located here, so yours is likely to be different since we all have our own ways of organizing things!
git branch
—> returns a list of all branches in the repository that were accessed on your local machine
git branch -a
—> list of all branches in remote repository
I typed git branch
and git branch -a
and here’s what mine looks like. There are currently two branches - the default main (sometimes called master) and dev.
We won’t be working in the main branch! Instead, we’ll be working in the dev branch.
git checkout [branch] —> git checkout develop
Here I typed git checkout dev
Make sure your fork is synced, you can do this on github.com/your-fork and click the sync fork button from the dev branch. Then type git pull
to make sure you have all recent changes on your local branch. You want to do this every time you start to work on a new feature!
It’s automated since the lead is the one who makes the changes on their end by merging your code to the dev branch!
Note: After inputting git pull
, you might see a message that says already up to date. That’s fine because it shows your branch is up do date!
The branch is up to date. Yay!
We’ll have to create a new branch from the develop branch. The new branch you will be creating will be used to code a new feature or bug fix (from the Backlog). The new branch will have a specific naming convention: [your name]/[the feature you’re working on]. Afterwards, we’ll switch to it!
Examples with visuals:
Let’s say I’m tasked with setting up Next.js for the project repository: