-
Notifications
You must be signed in to change notification settings - Fork 1
Home
For this assignment branches will be used for development and production. To get familiar with branches this is a good tutorial.
To make a copy of the remote repo onto your local machine go ahead and type the following line in your terminal.
$ git clone https://github.com/lucasbrsa/fury-of-dracula
Before you can add any of your changes, make sure that you've pulled any new changes made to the repo. If you skip this step, when you add your own changes there will be conflict.
$ git pull origin <branch>
Now that you've pulled the latest changes you can go ahead and add your own.
Note. Make sure to get used to always running a git pull
command every time you start work on your code. It's very annoying having to deal with conflicts.
It'll be a good idea to get accustomed with the below 3-step workflow as you'll be doing it a lot.
Once you're ready to add your changes the first step of the workflow is
$ git add .
or for a specific file(s) you've changed
$ git add <filename1> <filename2> ...
Once a file is added, it is sent to the git staging area. This is where it'll remain before it is committed. To view the files (and their changes) currently in the staging area use the below command.
$ git diff --staged
or if you only to view the name of the files use
$ git diff --name-only --staged
Now everything that's been added to the staging area needs to be committed. Make sure to add a commit message explaining the details of your change.
$ git commit -m 'commit message goes here'
If the -m
option is not specified the commit will be taken to the vim text editor where you can type a longer commit message.
This is the final step. Until you've completed this step, none of your changes will be live on the repo. To push your changes simply execute the following command.
$ git push origin <branch>
To verify that all changes have been made use
$ git status
This command should be used frequently to view where in the development history your changes sit.
In order for the main source code (master branch) to remain consistent, each contributor needs to push their changes to a development branch and create a pull request for those changes to be merged to the master branch.
The production branch for this repo is the dev
branch. This is where all of your final changes will be pushed to before they are merged into the master
branch via a pull request.
The master
branch contains the base code which can only be changed by an admin.
In order to view all branches (both local and remote) use the command
$ git branch -a
or
$ git show-branch
Then to select the branch you want to develop on
$ git checkout -b <branch>
In order to send a pull request you acknowledge your code is ready to be added to the master branch. The actual pull request itself is created on bitbucket and is very straightforward. Remember to be detailed and concise when describing the new changes your code will have.
Whenever the master
branch is ahead of your own branch use the following command to restore your branch to the current version of master
.
$ git rebase master
2020 20T2 | Lucas Barbosa / Stephen Morris / Eric Holmstrom / Debbie-Tommy