Hardware Reference
In-Depth Information
back to your remote repository at GitHub. You will need to know how to check to your project for changes, commit
those changes, and send them back to you GitHub repository. Then you will want to be able to get new changes form
your GitHub repository and add them to your local repository.
Code can be changed in many ways:
User git clone git@github.com:username/HelloGithub.git
Work process
Make changes to code:
Use the Arduino IDE to edit a sketch like
HelloGithub.ino .
Add or delete files.
Move files to various places in the project.
Edit files in libraries with your favorite text editor.
View changes
When you do make changes, you will want to know how to review them. Any time a change is saved, you can issue the
following commands to check your work:
$ git diff
Or show a summary of changes with:
$ git diff --stat
Saving and committing changes
Once you are ready to commit to the changes you made, you can now commit these changes to your local code
repository. Only staged changes are committed without the “ -a ”, to commit all changes, use “ -a” , like so:
$ git commit -a -m "Changed the files and fixed issue #1"
To commit only certain changed files list the named files, use the following:
$ git commit HelloGithub.ino "Update HelloGithub.ino and changed blink rate for issue #1"
Each of these commits are are identified by SHA-1 hash that represents all the changes in the commit. These
commits are saved code transferred from one repositoy or another. Also, you can check out different commits and
recreate the exact file structure and changes in their code. “ HEAD ” is an alias for the latest commit you have made.
The indicator “ ~1 ” is the equivalent of “ -1 ”; they can be combined to read “ HEAD~1 ”. It's also possible to say “ HEAD~2
which is two commits back from HEAD . For instance, if you want to check out the previous commit you could issue the
following command:
$git checkout HEAD~1
 
Search WWH ::




Custom Search