Skip to content

Github Workflow Cheat Sheet

acwooding edited this page Aug 27, 2020 · 8 revisions

Here are some common tasks in git/github. See also Configuring SSH Access to Github and the Git Tutorial.

Wondering how to use git/GitHub effectively with easydata?

Here's our suggestion for a reliable git workflow.

Create a standard setup

Walk softly, and carry a personal Fork

First, we strongly recommend work from your own fork. Instructions for doing this are included in the README that shipped with your easydata-based repo.

Swimming Upstream

Next, you should configure your git remotes so that origin refers to your personal github fork, and upstream refers to the source repo. Again, the README tells you how.

Can't see the forest for the branches

To make life easiest, use your master branch only for tracking changes in the upstream repo, and do all your development work in branches. This combination makes it much easier not only to stay up to date with changes the project repo, but also makes it easier to submit Pull Requests (PRs) against the upstream project repo should you want to contribute.

Our reliable git workflow

We suggest you start each day by doing this:

Where was I? What was I doing? Did I check it in?

git branch
git status
git add -p   # accept or reject parts of the patch
git commit -m "your commit message here"

Did I do any work elsewhere?

Did you do work on your branch, but on a different machine? Make sure your local branch is up-to-date with your fork:

git checkout master
git fetch origin --prune
git merge origin/master

What happened upstream?

Next, check if the upstream repo has been updated:

git checkout master
git fetch upstream --prune
git merge upstream/master
git push origin master
make update_environment

Update your local branches

Now that your master is up-to-date, you should use it to update your working branches. If you are already developing in a branch called, e.g. my_branch, do this before writing any more code:

git checkout my_branch
git merge master
git push origin my_branch

Create a clean working branch by doing a:

git checkout master
git checkout -b new_branch_name

Clean up, clean up, everybody, everywhere

Finally, clean up any of your old branches that are fully merged.

git branch --merged master
git branch -d {name_of_merged_branch}

This should be enough to get you going!

Clone this wiki locally