-
-
Notifications
You must be signed in to change notification settings - Fork 72
GoodGitPractices
steveraysteveray edited this page Apr 6, 2023
·
7 revisions
This is a brief cheat sheet for good practices as we use Github for QUDT. For general guidance on contributing to public projects on Github, please see this guidance, and in particular the section on submitting a pull request. There are essentially three stages:
- Ensure you are up to date on your fork of the repo:
git checkout main
git pull
- 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
- Do all your changes and additions and testing on this branch (srr-mynewbranch in above example). This might last for days or more.
- Check that all the changed files are the ones you intended using the 'git status' command below.
git status
- If so, add them for tracking (you can also add individual files or files satisfying regular expressions):
git add -A
- Frequently commit, so that each change can be tracked and rolled back if needed.
git commit -m 'Descriptive message about the change'
- Bring in the latest changes in main before you push:
git checkout main
git pull
git checkout srr-mynewbranch
git merge main
- 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
- This is most easily done via the Github website. Once you have pushed your branch, it will show up under the "branches" tab. Just click the button that says "New pull request". Pay attention to what the pull-downs say about what repository and branch is being merged into what other repository and branch. You will normally request to merge from your own fork/branch into the qudt/qudt-public-repo main branch.
(done by a member of the Approver team).
(File last modified 2020-02-19 by Steve Ray)