GitHub Workflow
Always, always, always
- be developing on a feature branch.
- be using git bash and the command line.
- be making frequent commits. (Pass a test, make a commit)
-
resolve merge conflicts in the feature branch.
Never, never, never
- make a push directly to the
dev
branch. - use IntelliJ's VCS fancy pants Git integration tool. (It's like riding a bike with training wheels and an 800hp engine strapped onto it, it seems like a good idea until it's not.)
- go all day without a commit, lose internet and put your team behind because you can't push up the code on your machine that you spent 3 hours on.
- have to handle a merge conflict on the
dev
branch
Sample new feature workflow
Following this workflow should keep you out of trouble when working on a new feature branch.
-
The start of a new branch:
git checkout dev
git pull
git checkout -b newFeatureBranchName
git push --set-upstream origin newFeatureBranchName
- This prepares the GitHub repository to take future pushes into the new branch.
-
During development:
git status
- Check to ensure that a push needs made and that no 'funky' stuff is going on.git add .
git commit -m "Enter your commit message here"
- Use two new lines before the last quote to add comments to the commit message.git push
-
After last push and the feature is complete:
git checkout dev
git pull
git checkout newFeatureBranchName
git merge dev
-
If any merge conflicts occur, resolve them with the following:
- Tell the team you have a merge conflict and use
git status
to find which files need resolved. Get a consensus with the developers that made the change that conflicts with your change as to how the code should look. If there is any doubt ask for help. code .
- Opens project in VS Code.- Use VS Code to resolve the merge conflicts.
git add .
git push
- Tell the team you have a merge conflict and use
-
When merge conflicts have been resolved, open a pull request:
- Go to the GitHub repository page and open a pull request to the
dev
branch. - Go to your team's Slack channel and ask for someone to approve your request and merge the code.
- Delete your feature branch.
git checkout dev
git pull
- Go to the GitHub repository page and open a pull request to the