I am experimenting with github for my open source PCB designs. I figured I should ask some basic questions about github:
- 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?
- 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?
- 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!
liudr:
- 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.
- 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
- 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.
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
I am looking at GitHub also, but for software/firmware packages that don't fit well in my Mercurial framework.