Notes from Aaron Meurer's tutorial on the git workflow
- Clone the repository.
git clone clone-url
-
Fork the repo on GitHub to your personal account. Click the Fork button on the main repo page.
-
Add your fork as a remote. This remote will be named after your github username. Go to the fork of the user repository (e.g. https://github.com/username/xxxx - replace username with the GitHub username-), and copy the clone url as in step 1. cd to the clone from step 1 and run
git remote add your-github-username fork-url
Before any changes, a branch should be created. Remember to never commit to master. The current terminal should be set up to display the current active branch.
- Update master. Before you make any changes, first checkout master and pull in the latest changes
git checkout master
git pull
- Create a branch. Once this is done, create a new branch. Make a branch name that is short, descriptive, and unique. Some examples of good branch names are
fix-install
,docs-cleanup
, andadd-travis-ci
. Some examples of bad branch names arefeature
,fix
, andpatch
. To create the branch:
git checkout -b branch-name
- Make your changes and commit them. Keep commits atomic <-> each commit should represent a single unit of change. Also write helpful commit messages, so that someone can understand what the commit does just from reading the message without having to read the diff.
git add filename [filename ...]
git commit -m "..."
- Push up your changes. Push the changes to your fork.
git push your-github-username branch-name
- Make a pull request. Go to the user fork repo on GitHub to see a button to create a pull request from the user branch.