Skip to content

Submitting Changes With Git

James Hochadel edited this page Sep 17, 2017 · 1 revision

To submit a change to cwru-hvz-source, use the following workflow. *Note: Is this your first change? Clone the repository first using git clone.

Development

  • Navigate to the cwru-hvz-source directory using your terminal.
  • Ensure you have the master branch checked out using git status.
    • If another branch is checked out, use git checkout master to switch branches. If you've made changes on your current branch, commit or stash them before changing to master.
  • Pull the latest version of repository using git pull.
  • Create a new, descriptively-named topic branch from master using git checkout -b new-branch-name. Note that if you did not switch to master in the previous step, this step will create a new branch based on your currently-checked-out branch.
  • Do your development locally on the topic branch, creating "atomic", well-named commits as you go.
    • "Atomic" means indivisible; each commit should contain a set of logically related changes. Two unrelated changes should go in two separate commits.
    • Remember that good commit messages don't describe what you did, they describe why you did it. If someone wants to see what you did, they'll just read the code. Describing your intent gives helpful context.
  • Optional: Once you're done developing and you're ready to publish your changes, run git rebase -i HEAD~#, where # is the number of commits you've made. You can see how many commits you've made by running git log.
    • The rebase -i command allows you to squash several commits together, making your history more clean. For example, when you're developing locally, you probably want to make lots of small commits so that you can undo one if necessary. However, when merging to master, it might be more helpful for the commits to be combined into one larger commit, containing the entire feature or bugfix you worked on.
    • Do not run a rebase if you've already published the branch. Once your history is public, it should not be changed.
  • Push your topic branch once you're happy with your changes.
  • Create a pull request to master on GitHub. If someone is available to review your code, assign them as a reviewer. Otherwise, review the PR and merge it yourself.

Deployment

To deploy a new version of cwru-hvz-source to the production server:

  • Submit a pull request from master to production. Review the changes and approve the request if they're ready to be sent to production.
  • Create a new release in Github with an appropriate version number and description. Github's release interface.
  • Log into the server using ssh and follow instructions for deployment.
Clone this wiki locally