Git Workflow - GeeksterJH/coloretto GitHub Wiki
To add new features to the project we will be using git branches
. A branch allows you to create a separate workspace in the git project where you can make as many changes as you want without affecting the rest of the project. Once you've made all your changes/commits/... you can create a pull request to merge it with the actual project.
Steps:
- To create a new branch, use the command
git checkout -b <name_of_branch>
, the name of the branch should describe the feature you're implementing. - On this branch you can make as many changes and commits as you like without having to worry about messing up the project.
- To upload your branch to github, use
git push -u origin <name_of_branch>
- Once you're done with the feature and you're certain everything works, you can make a pull request by going to the
pull requests
tab on github and clickingNew pull request
- Next up, you need to select your branch, give your pull request a description and click
New pull request
- Once you've made the pull request I will be able to see it and comment on it if it needs any more changes.
- Once the feature is ready it can be merged into the
master
branch - Once the pull request is merged into the
master
branch, you will have to switch back to the master branch usinggit checkout master
and then rungit pull origin master
to bring everything up to date. From here, you can create a new branch to implement another feature.
Making A Git Commit
- use
git add .
to add all your changes - use
git commit -m "<commit message here>"
Your commit message should describe what you've changed and why - use
git push -u origin <name_of_branch>
to push your code to github, make sure you don't usegit push
because that will push your changes to the master branch