What is Git?
Git is a free and open source version control system. It was developed by Linus Torvalds who also wrote the Linux OS. The process of keeping tracks of changes in computer system over time is known in programming as version control. Although there are many other source control software available, Git has more advantage over the rest. You can easily go to Git to see the documentation and also to download it. The download comes with a terminal – Git Bash. Terminal or Bash is a way to instruct your computer to do things by typing commands rather than clicking applications with your mouse.
You can use this terminal to interact with your remote(online) files. You can also use your normal windows command prompt if you are using windows. I don’t know how confusing or how basic this might be to you. But I always believe we’re together. I’m not going to be telling you the commands you need to type in order to manipulate your remote and local files. There is already an app I would recommend for that.
Visit jlord on GitHub to download the app depending on the OS you’re using. The app would teach you the commands you need to know. It’s free! Isn’t that a great news? I bet it is. It’s now only the commands, you would learn about GitHub and its terminologies.
Let’s look into what repository is before we talk about GitHub. A repository is a collection of files related to a software project. You can imagine it as a project folder with all the relevant files inside of it. Sometimes they’re called “repos” for short.
You tell Git what your project is and Git will start tracking all of the changes to that folder(version control). This makes it a Git repository: a folder of items being tracked by Git. Git tracks when files are added, subtracted or even a single letter in a single file is changed. All of this plus who did it and when is tracked by Git.
The changes you make to your repositories need to be saved. This is called “commit“. They are the moments in which you save and describe the work you’ve done. Commits are core to using Git.
When you create repos using your terminal, make changes to it and commit it, it is called local repository. It is just on your computer. No other person can see it except the user of that system. This is where GitHub comes to play an important role. GitHub is a website that allows people everywhere to upload what they’re working on with Git so that everyone can easily work together on the same project. GitHub which acts as the central repository for you and everyone else to share. You push your changes to it and pull down changes from others. Visit github.com to create a free account.
You Push your local repositories to GitHub servers. in that case, it becomes a remote one. All these you can do using bash/terminal. The projects in your GitHub account are termed remote repositories. You Pull repos from GitHub into your machine to work with it locally.
You wouldn’t want to commit the changes you’ve made on your repos ultil you’re sure it worths it. This is why you should create branches. The main branch is called the master branch.
Fork and Clone
When you fork a repository, you’re creating a copy of it on your GitHub account. Forks are used for creating your own version of a project.
To get a forked repository from your GitHub account onto your computer you clone it. This cloning action copies the remote repository onto your computer so that you can work on it locally.
GitHub really makes it so easy to work with others. Others can contribute to your projects through pull requests. GitHub makes a simple community for developers. Try and get into it and see other great help you can get from Git/GitHub. The best way to learn it by doing thing/practice not by reading too long articles. Do it yourself, if you get stuck you can always ask questions here or any other places.