Hardware Reference
In-Depth Information
At this point, you have all the changes from the GitHub repository. You do not have to fetch until something
changes on Github again. At this point you can use “ git diff ” and examine the changes that were made on the
server from a local copy. Once you are ready, merge the changes from fetch into your local repository. This is the
merge command:
$ git merge master
The “ master ” key term is for the master branch of the code that was fetched. Most changes can be merged
without a conflict. The pull command combines the fetch of changes with a merge . This is a very convenient way to
get changes from your GitHub repository. The full command is:
$ git pull
Once you have successfully pulled your changes to from your GitHub repository. You can immediately begin
editing, changing code, and working on your project. As needed, use the above commands to help you complete these
common tasks. The options I have outlined are just for getting started with Git; it is a very complex and powerful tool.
This chapter should get you started, but for more detail on the commands, see the Apress book called Pro Git , which
can help you dig in deeper.
Workflow Summary: Creating Your Own Project
We walked through the creation of the HelloGitHub project to demonstrate GitHub's commands, but there is a
pattern in the steps we took. Follow these same steps for any project you create and you have workflow that ensures
version control for one or multiple creators. Summarizing the steps we already took, we see the common steps for
working on any project:
1.
Create the project on GitHub.
2.
Clone the project to your local machine.
3.
Make changes to the code.
4.
Add or remove files.
5.
Commit changes to your local Git repository.
6.
Push those locally committed changes to your “origin” repository on GitHub.
7.
Repeat steps 2-6 as needed.
These steps allow you to work locally and keep up to date with your project. You can use git diff, and git diff -stat
or any of the many Git commands to check the difference in code version, and the changes over time for the project.
Workflow Summary: Forking Another Project
Frequently there are existing projects that you want to use, but you might want to change the configuration for your
hardware, or want to add a feature to the project. Since I work with many different kinds of Arduino compatible
boards, not every project is designed to work with one I'm using. For instance, between the Arduino Uno, and the
Arduino Mega, the SPI pins are numbered differently. I will typically fork the project, and then make the needed
changes to my forked copy of the project. Once I'm sure the code changes are working, I can do a pull request that
allows the maintainer of the main project to merge those fixes to their project.
We will use the HelloGithub project at the Pro Arduino GitHub site, https://github.com/ProArd/HelloGithub ,
and run through the fork process with it. Once you find the HelloGithub project, you can select fork. This copies the
project into your own GitHub area. Then you will want to make a copy to your local machine by cloning it.
 
Search WWH ::




Custom Search