Let us state it upfront, we promise to keep this article as non-technical as possible without loss of usefulness.
There is a widely-spread misconception that GitHub is a sophisticated tool used by programmers and requiring solid technical background to operate. Wrong! Do you know what GitHub is? A social network! Yes, a kind of Facebook where you can post and share the projects you have done, let people contribute (add, fix, comment), and learn from each other. And it is not techy at all – to get started you need to know just a few terms and actions. So, let our GitHub tutorial for beginners begin.
Terms and Concepts
Repository (repo) – a location where your projects reside. It can be either a local folder on your laptop, or an online storage on GitHub. You can put any sorts of files into the repo – documents, images, audio, etc. (not just programming code!)
Version Control – the very essence if GitHub and the reason for its existence. It’s the ability of GitHub to make snapshots of the current state of your projects/files, before applying changes to them. This way you can always “unwind” to a stable version if the changes made do not lead to the desired results. Version control also takes care of managing changes by multiple users at the same time to avoid corrupted files or overridden changes.
Branch – a personal copy of the project that you (and everyone else involved) work on before you decide to commit changes (see below) and merge it with the master (main) copy.
Commit – a special record memorizing all changes you are making to all files in the project since the previous commit. If necessary, you can go back to the state of any of the prior commits without encountering conflicts or loss of information.
Note: as this is a Github tutorial for beginners, some parts will be explained thoroughly, while others may be omitted to avoid overcomplicating.
Create an account. As in any social network, you are supposed to have a personal page where all your information and data will be available. This is a very straightforward and intuitive process that will take just several minutes. Just visit github.com, enter your username, email address and password, click the big green button and you are already a member of Github community.
Create a repo. Once on github.com, click on the book icon next to your username. Give your repository a descriptive name. Select the Public radio button if you are ok with everyone having access to your work (which is usually the reason to create a repo in the first place). Click the green Create Repository button, and your space of Github is secured.
Create a local copy of your repo. Since most of the work on the project you are likely to be doing locally on your computer, you need to have an up-to-date version of your work easily accessible, and to be able to synchronize it back and forth with the online location. This step requires a tiny bit of command prompt use (minimal, we swear).
· Install Git on your machine.
· Create a folder, where your local copy of the project will live, by running this line in mkdir ~/MyProject
· Note: it would reasonable to give this folder the same name you gave to your repo on Github.
· Make his newly created folder an active folder by switching to it like this: cd ~/MyProject
· Run the following line to initialize your local folder as a local Git repository: git init
Adding files to the repo. Say, you created a new file logo.png and want to add it to your repository. You start by copying it into your MyProject folder. But at this point, Git does not recognize it as a part of the repo. To force it to do so, execute:
git add logo.png
Committing changes to the repo. Now that there is a new file in your repo, you want this change to be visible to all collaborators, so you must publish your changes:
git commit -m “Added logo.png”
Connecting to the remote repo. For anyone to acknowledge your input, the changes should be publicly accessible online. So, you should tie your local folder to the remote repository:
git remote add origin “https://github.com/YourUsername/myproject.git”
Uploading to remote repo. Finally, to make your work available to public, push changes like this:
Done! It’s all out there waiting for comments, criticism, and admiration.
This Github tutorial for beginners is far from being comprehensive. Rather, it’s letting you feel the flavor of what this tool is about and how almost everyone can benefit from using it. Github itself has a detailed and easy-to-use help center that can guide you through the specific areas of the product that you decide to explore.