Skip to content

GoodGitPractices

stevepublic edited this page Dec 5, 2019 · 14 revisions

QUDT Best Practices for Github

This is a brief cheat sheet for good practices as we use Github for QUDT. There are essentially three stages:

  1. Making changes to file(s)
  2. Submitting a pull request for review
  3. Reviewing and merging

Making changes to file(s)

  1. Ensure you are up to date:
    git checkout master
    git pull
  1. Create a new branch for your work. Please name your branch beginning with your initials, a hyphen, then some topical name:
    git checkout -b srr-mynewbranch
  1. Do all your changes and additions and testing on this branch (srr-mynewbranch in above example). This might last for days or more.
  2. Check that all the changed files are the ones you intended using the 'git status' command below.
    git status
  1. If so, add them for tracking (you can also add individual files or files satisfying regular expressions):
    git add -A
  1. Frequently commit, so that each change can be tracked and rolled back if needed.
    git commit -m 'Descriptive message about the change'
  1. Bring in the latest changes in master before you push:
    git checkout master
    git pull
    git checkout srr-mynewbranch
    git merge master
  1. Push your branch to the remote. The first time, you'll need to create the branch on the remote:
    git push --set-upstream origin srr-mynewbranch

Later, when you are on your branch, you can just say

    git push

Blah blah Another blah blah from testbranch

Let's reference another page.

Go to top

Clone this wiki locally