# Github basics?

**URL:** <https://forum.arduino.cc/t/github-basics/309137>\
**Category:** Hardware Development\
**Created:** [May 3, 2015, 7:53pm UTC](https://forum.arduino.cc/t/github-basics/309137 "2015-05-03T19:53:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![liuzengqiang](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/liuzengqiang/32/213605_2.png) [@liuzengqiang](https://forum.arduino.cc/u/liuzengqiang)\
**Post date:** [May 3, 2015, 7:53pm UTC](https://forum.arduino.cc/t/github-basics/309137/1 "2015-05-03T19:53:43Z")

</div>

I am experimenting with github for my open source PCB designs. I figured I should ask some basic questions about github:

1. If I post a repository on github, and have git GUI running on my PC, then all I have to do is to run the git GUI once in a while to keep my online repository up to date, right?
2. How do I control versions? I am used to naming files with version numbers. This way I get a lot of files in my repository, which is confusing to someone that wants to download it. If I only keep one file, without version number, I am afraid that I will eventually make a mistake and have no previous file to go back to. Is this concern invalid? Can I roll back files or have a history of files using my git GUI?
3. About repositories from others such as sparkfun, should I just "clone to desktop" using my git GUI instead of downloading zip files, which the prior can stay up to date if I run git GUI often? What happens if I want to keep different versions of the same repository, say for comparison purposes?

Thank you!

---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [May 5, 2015, 1:08am UTC](https://forum.arduino.cc/t/github-basics/309137/2 "2015-05-05T01:08:37Z")

</div>

[http://forum.arduino.cc/index.php?topic=320298.msg2216822#msg2216822](http://forum.arduino.cc/index.php?topic=320298.msg2216822#msg2216822)

[http://forum.arduino.cc/index.php?topic=320298.msg2217713#msg2217713](http://forum.arduino.cc/index.php?topic=320298.msg2217713#msg2217713)

---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [May 5, 2015, 1:15am UTC](https://forum.arduino.cc/t/github-basics/309137/3 "2015-05-05T01:15:50Z")

</div>

> liudr:
> 
> 1. If I post a repository on github, and have git GUI running on my PC, then all I have to do is to run the git GUI once in a while to keep my online repository up to date, right?

Correct. You "commit" to save changes to a local repository. You "push" to merge those changes with the repository on Github.

> 1. How do I control versions?

"Versions" in the sense that you and I would consider something to be a version are usually controlled with "tags".

> Can I roll back files or have a history of files using my git GUI?

Yes. However, you can do significantly more than just "roll back". Git allows you to branch a repository at any point creating a parallel development path. That branch can later be merged with other branches.

Reading about "git workflow" should help bring some clarity...  
[https://www.google.com/search?q=git+workflow](https://www.google.com/search?q=git+workflow)

> 1. About repositories from others such as sparkfun, should I just "clone to desktop" using my git GUI instead of downloading zip files, which the prior can stay up to date if I run git GUI often?

I often do. "Staying up to do date" is called a "pull / merge" in Git lingo.

> What happens if I want to keep different versions of the same repository, say for comparison purposes?

Don't keep different versions of a repository; there is no need. The entire commit history **is** a repository. You can easily compare any commit / tag / branch to any other commit / tag / branch.

---

<div class="post-metadata">

**Author:** ![robtillaart](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robtillaart/32/1098811_2.png) [@robtillaart](https://forum.arduino.cc/u/robtillaart)\
**Post date:** [May 5, 2015, 7:52am UTC](https://forum.arduino.cc/t/github-basics/309137/4 "2015-05-05T07:52:00Z")

</div>

This site has great tutorials and tools - [Git Tutorials and Training | Atlassian Git Tutorial](https://www.atlassian.com/git/tutorials/)

---

<div class="post-metadata">

**Author:** ![ron\_sutherland](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ron_sutherland/32/218203_2.png) [@ron\_sutherland](https://forum.arduino.cc/u/ron_sutherland)\
**Post date:** [May 7, 2015, 7:21pm UTC](https://forum.arduino.cc/t/github-basics/309137/5 "2015-05-07T19:21:58Z")

</div>

Much of what can be done with git is similar to Mercurial (Hg). But, I have been using Mercurial for some time so have developed a bias for it.

To start a repo "hg init" in the location, and it is the same with "git init". The GitHub application allows creating a repo and so does the TortoiseHg application. Once the repo is created files are added to it and then committed, both hg and git are similar about this.

Some things I do with Mercurial that I have no clue how to do with git. Hg has a concept of named paths in its hgrc file (all repos have it under /.hg/hgrc ). On Windows, TortoiseHg has a global setting to push after a commit to one of the named paths, which I set to push to a local 2nd hard drive (and that saved my bacon last week). There is also a changegroup hook\* that I use to automagicly update my web files when I push to the repo on my web server.

\*[http://mercurial.selenic.com/wiki/Hook](http://mercurial.selenic.com/wiki/Hook)

I am looking at GitHub also, but for software/firmware packages that don't fit well in my Mercurial framework.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 12:06pm UTC](https://forum.arduino.cc/t/github-basics/309137/6 "2021-05-06T12:06:22Z")

</div>


