Some Misc Notes
← prev | next →     Top-level ToC     /git/a-github-workflow.html     (printable version)

For the most part, this is regarding working on a repo where others are working as well, and where you want to do your work in feature branches.

You don’t ever want master to be broken.

The following assumes you’ve got commit access to the project.

git clone git@github.com:user-or-org/project-name.git
cd project-name
git checkout master   # usually not necessary
git branch my-changes
git checkout my-changes

# Work on your changes...
# {edit edit edit}
git add -p
git commit

# ...and periodically bring your master up-to-date with origin,
# *and* make your branch be based off of the newly-updated master.
git checkout master
git pull origin master   # fetches and merges recent commits
git checkout my-changes
git rebase master

# Finally, when you're ready to move your changes
# into master (and then into origin's master):
git checkout master
git merge --no-ff my-changes
git push origin master