Hardware Reference
In-Depth Information
6.
Clone your project with the following:
$ git clone git@github.com:YourUsername/HelloFork.git
7.
Set the official HelloFork repository as the upstream repository:
$ cd HelloFork
$ git remote add upstream git@github.com:proard/HelloFork.git
8.
Since you just cloned it there are no changes, but once changes have been made you will
want to fetch and merge changes from upstream with these commands:
$ git fetch upstream
$ git merge upstream/master
9.
You can do a test of the merge by doing a dry run, using the following commands:
$ git merge --no-commit --no-ff upstream/master
$ git diff upstream/master -stat
If you want to see the difference between the changes that are being made, you can compare your code with the
code on your GitHub repository with the “diff ” command:
$ git diff origin/master
You can get a quick summary of the file changes by using “—stat”
$ git diff origin/master --stat
Given this list, we need to define a couple of new concepts. First, an upstream repository is typically the project
that you forked into your GitHub repository. Secondly, every so often you will want to go back to the original project
and pick up new files and code changes, so that you can synchronize your work with the main project. Your original
project on GitHub is called “origin.” The latest version of code is called “master.” So you can compare the latest
versions of “origin/master,” or “upstream/master,” with your local repository. Over time, projects can get further out of
sync. If you fetch the changes from the upstream repository, you can bring the changes to your local machine without
clobbering your own code, without breaking existing work by hitting it with a write over. The upstream master code
will not automatically update your working area in the local master. After a fetch, you have to take specific action to
merge those changes into your own project. git merge defaults to merging the fetched master with your local working
master repository. The merge process will combine those changes into your local project.
Creating a Pull Request
In the section we will modify the HelloFork.ino sketch to have your Arduino username and submit the change as a
pull request to the official Pro Arduino repository for the HelloFork project. At this point you will already have the
forked from Pro Arduino, and cloned to your local system. So now edit the HelloFork.ino sketch to include your
GitHub username. The code will look like:
/*
* Hello Fork Github Example Arduino Sketch
* Just add your GitHUb account ID and I'll add your pull request to the project.
*/
 
Search WWH ::




Custom Search