A lot of people on the internet, most of them programmers and developers, constantly talk about Github and repositories. But what are these? How do these tools can help you organize your project?
Fuente
What is Github?
Github is an online version control system (VCS) and a simple web host service that let us use all the benefits of Git. Its main feature is that it keeps a record of all the changes that you make to your source code files and software. This means that with Github you can know exactly which lines of your files were modified: which ones were added and which ones were deleted. In addition to this, Github let us write a little description of all the changes that we're making on our files, so later in our project, we can identify better all the changes during the lifecycle of our project.
New lines appear in green, and deleted lines appear in red
Git, Github, isn't it the same thing?
A lot of people make the mistake of confusing Github and Git. They are not the same. Github is a web service based on Git, whereas Git is the engine behind Github, it's the component in charge of keeping all the records of the changes in our files, organize them, and fix any conflict that may occur with them, and Github is a website in which we can make use of these Git features.
Perfect for working with a team
One of the main and most important features of Github is that it allows many people to work with the same file at the same time, and Git is in charge of merge all these changes in the same file correctly. It also lets you see who modified which file and which changes that person made.
Statistics of two users working in the same project
project.py, project1.py, project1final.py, project1finalfinal.py ... Not anymore!
Forget about having 10 copies of the same file and the only difference between them is a number in their titles that apparently identifies the file, but you will never remember what meant each number. With Github you only work with one copy of the file and every version of it is identified with an alphanumeric sequence of characters called hash. Github allows you to explore every version of your files, so you can see which changes have been made to it, and everytime you want to modify it, the old file is kept but the part that you modified is updated.
Changes made in the file index.html, the description of the changes can be seen in the left side and their respective hash in the right side
Go back in time
Yesterday my program worked like a charm, but today I made so many modifications that I cannot undo all of them and now, it doesn't work at all.
This situation is kind of common between programmers. The good thing is that Github allows you to go back in time, this means, you can restore the version of your program that was working yesterday, without the need of creating any copies of your files. This is possible because you can reset your files to an older version, the only thing that you need is the hash that identifies the version you want to restore, and due that every time we make a new change we introduce a brief description of that change, finding the hash that we need is an easy task.
Git/Github basic terminology
Repository: is the container of a project. We keep all the files of our project in these. We should make a repository for every project. The repositories can be store in our computers (locally) and/or in our Github account. We should keep our repositories synced both on our computers and on Github.
Branches: their name is very intuitive. The branches allow us to create ramifications of our projects, either because we want to test a new feature, add a new feature, or fix some bugs, having an exact copy of our project, without modifying the original. Once you've finished making the changes, you can merge the two branches (your new-featured branch and your original branch) and merge them, so the new changes can be added to the original files.
Commits: are the changes that we make in our files. Once we've finished modifying certain files, we add a little description of the changes and then we commit the change, in other words, we are saving our changes in Github.
Pull and Push: when an user makes a Pull, all the new changes in our Github account will be added to our local repository, the one that we keep in our computer. On the other hand, when an user makes a Pull, all the changes (commits) that we have made and are stored in our computer will be uploaded to Github. So, let's say I'm in my office and I made some new changes, and made a commit in order to save these new changes and then I push them to my Github account. Then, when I arrive home, I pull these changes in my computer, so my local repository is up-to-date with all the new changes I pushed in my office. So: Pull means download, and push means upload.
Merge: a merge is an action that allows us to merge or put together two branches. Let's say I have two branches named A and B. A friend of mine was working on B and added a lot of new features, and I want them to appear in my branch which is A, so I merge B into A, and all the changes that my friend made will now appear in my branch.
In other opportunity I will show how to make a basic usage of Github.
Its my favorite source control. Can be a brick wall learning curve for new people though
I agree, the learning curve is quite steep at the beginning., people usually gives up before knowing how to master the basics, but it's totally worth the effort. Thank you very much for your comment!
we all love github! <3
Yeah! Ironically, a few months ago (8-9) I didn't like Github at all. Now I even make repos for keeping things as simple as notes haha. Thank you for your comment!
Thanks from someone who was a Github thicko but now knows a little more (even if she doesn't understand it....but that's not your fault) - great article :)
Thank you very much :) If you have any doubt about it, you can ask me, I will try explaining it the best I can :)
That is very kind of you - and I will bear that in mind (although I doubt you are a miracle worker lol) - I upvoted your kind comment :)
With GIT it gets easier once you get over the initial learning hump. Something like GitExtensions on windows makes it easier. VS 2017 has ok support built in now
Upvote, not enough people know how to reward good comments :)
I was waiting until my tiny voting power had recharged a little. We don't know how much steem might be worth in the future so it's worth waiting. Here's my upvote now :) Thanks for the helpful comments :)
Nice post, I think GitHub is extremely useful
Thank you! Glad to see you back here. Yes, Github is very useful. I wish more people used it.