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:

    1. git checkout dev
    2. git pull
    3. git checkout -b newFeatureBranchName
    4. git push --set-upstream origin newFeatureBranchName - This prepares the GitHub repository to take future pushes into the new branch.
  • During development:

    1. git status - Check to ensure that a push needs made and that no 'funky' stuff is going on.
    2. git add .
    3. git commit -m "Enter your commit message here" - Use two new lines before the last quote to add comments to the commit message.
    4. git push
  • After last push and the feature is complete:

    1. git checkout dev
    2. git pull
    3. git checkout newFeatureBranchName
    4. git merge dev
  • If any merge conflicts occur, resolve them with the following:

    1. 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.
    2. code . - Opens project in VS Code.
    3. Use VS Code to resolve the merge conflicts.
    4. git add .
    5. git push
  • When merge conflicts have been resolved, open a pull request:

    1. Go to the GitHub repository page and open a pull request to the dev branch.
    2. Go to your team's Slack channel and ask for someone to approve your request and merge the code.
    3. Delete your feature branch.
    4. git checkout dev
    5. git pull