Open Source : An unlimited resource of learning.

Open Source : An unlimited resource of learning.

Unlocking the Power of Collaborative Development and Learning


My discovery of Open Source was triggered while I was working on a real-life solution as part of my internship. I was introduced to an Open Source expert who opened my eyes to the unlimited resource haven that is Open Source, particularly through GitHub.

GitHub is best website for young developers i.e., me , to learn and grow vastly, but it is essential to learn how to operate GitHub and how one can use their own personal computers and connect it to make their own repositories on the website. It is fairly easy and everyone can do it. So let me explain how :

Firstly lets go over few basic commands you must know to navigate through your own personalized computer :

Setting-Up

It is preferrable to download "GitBash" as it is an application that allows bash commands to run on windows and will be much useful later on. The basic commands that you will learn now can be executed on your operating system's terminal. It is also important you have an

Basic Navigation Commands

  1. pwd (Print Working Directory)

     pwd
    

    Displays the current directory path.

  2. ls (List)

     bashCopy codels
     ls
     ls -l   # Detailed list
    

    Lists files and directories in the current directory.

  3. cd (Change Directory)

     cd
     cd ~                    # Navigate to home directory
     cd ..                   # Navigate up one directory level
    

    Changes the current directory.

  4. mkdir (Make Directory)

     mkdir   # Create nested directories
    

    Creates a new directory.

These are the few basic commands that you can use to navigate through your computer or to make new files.

Now that we have covered the basics needed to understand Git and how it works lets jump into what it is but before that , here's a small exercise I want you to do on your personal devices.

"Save a folder named "OpenSourceforthewin" on your desktop and add the file "GitHub.py" in it"

Hint : Navigate to 'Desktop' and use the command 'mkdir' Highly recommend using 'GitBash' so do yourself a favor and install it in your personal devices.

Do not worry if you do not get it , you always learn something new everyday . Below is the answer for the exercise. You will see that a folder with the name 'OpenSourceforthewin' has been created on your desktop , and within the folder there is a python file (.py) with the name 'GitHub'.

  1.   cd Desktop
      mkdir OpenSourceforthewin
      cd OpenSourceforthewin
      touch GitHub.py
    

Once you have understood this you are fully equipped to understand Git and how to work it like pro. Now let's jump right in.

Git

First things first : Create a GitHub account if you do not have one already and download Git on your personal devices. The next section requires you to have a 'GitHub' account in order to understand it.

What is Git?

Git is a distributed version control system (VCS) that enables multiple developers to work on a project simultaneously without overwriting each other's changes. It tracks changes to files and allows you to revert back to previous versions if necessary.

Key Concepts and Terminology

  1. Repository (Repo)

    • A repository is a storage space where your project files and their histories are stored. It can be local (on your computer) or remote (on a server).

    • On GitHub the first thing you do is make a repository!!!

      If you look at the top right side of the image, you'll find the option to create a new repository.

  2. Clone

    • Cloning a repository means creating a copy of it on your local machine. This allows you to work on the project locally.
  3. Commit

    • A commit is a snapshot of your repository at a specific point in time. Each commit has a unique ID (SHA) and includes a message describing the changes.

    • We use a commit to update our code every time we change it. We will shortly see how we use it.

  4. Branch

    • A branch is a separate line of development. The default branch is usually called main or master. You can create new branches to work on features or fixes independently from the main codebase.

  5. Merge

    • Merging is the process of integrating changes from one branch into another. This is typically done to incorporate feature branches back into the main branch.

    • Usually open source codes are public and allows multiple people to take part in it. But it is overlooked by an administrator and he controls the authority to merge your code with the main code only if it benefits the project.

    • A merge can only be done if a pull-request exists.

  6. Pull

    • Pulling is the process of fetching changes from a remote repository and merging them into your local repository.

  7. Push

    • Pushing sends your local commits to a remote repository, making your changes available to others.
  8. Remote

    • A remote is a version of your repository that is hosted on the internet or another network.

    • It is very important to have your remote id to connect your personal device to the GitHub Repository.

All in all, Git is a super important tool for keeping track of your code. When you're working on a project, make sure to use Git.

Here's how you use it:

Basic Git Workflow

  1. Clone: Create a local copy of a remote repository.

     clone https://github.com/user/repo.git
    
  2. Stage: Add changes to the staging area.

     add filename
     git add .
    
  3. Commit: Save changes to the local repository.

     git commit -m "Commit message"
    
  4. Push: Upload changes to a remote repository.

     git push -u origin main
    

Where you use it :

I have already mentioned VS Code, this is a code editor, you may download any code editor and the commands above must be performed in the terminal, i.e., the terminal where you run your code.

You can learn more git commands at https://education.github.com/git-cheat-sheet-education.pdf

Let's now formally understand what GitHub is and how you can use it to stay ahead of your peers.

Github

What is Github?

GitHub is a web-based platform that provides hosting for Git repositories. It offers all the distributed version control and source code management (SCM) functionality of Git along with its own features designed to improve collaboration, project management, and social coding.

Key Features of GitHub

  1. Repositories: GitHub hosts Git repositories, enabling collaboration on code.

  2. Forking: Create a personal copy of someone else's repository to make changes and improvements.

  3. Pull Requests: Propose changes to a repository, which can be reviewed and discussed before being merged.

  4. Issues: Track tasks, enhancements, and bugs for your projects.

  5. Actions: Automate workflows, such as testing and deployment, with GitHub Actions.

  6. Pages: Host static websites directly from your GitHub repository.

  7. Wiki: Create and maintain documentation for your project.

Best Practices for Using Git and GitHub

  1. Commit Frequently: Make small, frequent commits with clear messages.

  2. Use Branches: Create branches for features, fixes, and experiments to keep the main codebase stable.

  3. Write Descriptive Commit Messages: Clearly describe what changes were made and why.

  4. Collaborate with Pull Requests: Use pull requests to propose, review, and discuss changes before merging them.

  5. Keep Repositories Clean: Regularly delete branches that have been merged or are no longer needed.

The future of open source looks incredibly promising. As more organizations recognize the benefits of open source, we can expect to see increased adoption and contribution to open source projects. Additionally, the rise of open source hardware, open data, and open science are expanding the open source philosophy beyond software, fostering innovation in new and exciting ways.

Empowerment of individuals is a key part of what makes open source work, since in the end, innovations tend to come from small groups, not from large, structured efforts.

Tim O'Reilly