Significance of Open Source

PARITOSH DADHICH
GirlScript Bangalore
8 min readNov 8, 2020

I believe the best feeling you ever is by contributing and helping others. For many developers, Open Source contribution is one of the ways.

Let us dive into Open Source and see why it is important?

Open Source:

Open source is a type of license agreement that allows users to modify a work, use said work in new ways, integrate the changes or different versions into a larger project, or derive a new work based on the original. By removing barriers between innovators, open-source promotes a free exchange of ideas within a community to drive creative, scientific, and technological advancement.

Why Open-Source?

Open-source licensing encourages innovation through collaboration. Without it, many of the technologies we take for granted today would never have developed or would be locked away behind patent law. The open-source movement is the reason that technology has grown at such a breakneck pace for the past few decades.

Open-Source contributions help students to learn new industry-based skills and enhance the spirit to work collaboratively for the development of the community. Students can work on projects to create a difference and make a massive change in the day to day life. Some examples of the applications developed through open source contributions are Firefox, MySQL, Linux, Java, Flutter, Apache, Android Studio, and others.

There are many Version Control Systems for contributing to Open-Source like CVS, SVN, GIT, Mercurial, Bazaar, and others. However, GIT is very popular among contributors and developers.

Why GIT?

Git is a free, Open Source Distributed Version Control System tool designed to handle everything from small to large projects with speed and efficiency.

Let us break the Distributed Version Control System to get better clarity:

  • Control System: This means that GIT is a content tracker, so it can use to store content.
  • Version Control System: A version control system (VCS) is a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If an error is made, developers can turn back the clock and compare earlier versions of the code to help fix the errors while minimizing disruption to all team members.
  • Distributed Version Control System: A distributed version control system (DVCS) is a type of version control where the complete codebase — including its full version history — is mirrored on every developer’s computer. Git is a Distributed Version Control System since the code is present in every developer’s computer.

The world’s most renowned projects (like the Linux Kernel, Ruby on Rails, or jQuery) are using GIT as their VCS of choice. Real-life projects generally have multiple developers working in parallel. So a version control system like GIT is needed to ensure there are no code conflicts between the developers.

Additionally, the requirements in such projects change often. So a version control system allows developers to revert and go back to an older version of the code.

Finally, sometimes several projects which are being run in parallel involve the same codebase. In such a case, the concept of branching in GIT is very crucial.

Git Workflow:

Before start working with Git commands, it is necessary to understand what it represents.

What is a Repository?

A repository is also known as “repo is nothing but a collection of source code.

There are four fundamental elements in the Git Workflow.

  • Working directory: The working tree, or working directory, consists of files that you are currently working on. You can think of a working tree as a file system where you can view and modify files.
  • Staging Area: The staging area is the intermediate state between your working tree and the local repository. Once you do changes in your working tree, you add those changes to the staging area by issuing the GIT add command.
  • Local Repository: The local repository is the area where your changes are committed. Once you stage your changes to the staging area, you need to commit those changes using the git commit command that adds your changes to your local repository.
  • Remote Repository: A remote repository (often called a remote) is a common repository that all team members use to exchange their changes. In most cases, such a remote repository is stored on a code hosting service like GitHub or an internal server.

Installation & Set up:

Download Git and install it into your device by clicking the “next” buttons. Once Git is installed into your device, press the right key, and select Git bash.

Run git — version command to check the version of Git.

Let us understand some basic commands of GIT!

git init:

This command turns a directory into an empty Git repository. It is used to make an existing project as a Git project.

Commands:

  • change directory to codebase: cd /file/path/to/code
  • make the directory a git repository: git init

After running git init, adding and committing files/directories is possible.

git add:

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.

Command: git add <file or directory name>

git commit:

The git commit command captures a snapshot of the project’s currently staged changes. Committed snapshots can be thought of as “safe” versions of a project — Git will never change them unless you explicitly ask it to.

Command: git commit -m “Commit message in quotes”

git status:

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.

git config:

The git config command is a convenience function that is used to set Git configuration values on a global or local project level. It is used in the configuration settings like email, username, and editor.

Command: git config <setting> <command>

git branch:

When you want to add a new feature or fix a bug — no matter how big or how small — you spawn a new branch to encapsulate your changes. This makes it harder for unstable code to get merged into the main codebase, and it gives you the chance to clean up your future’s history before merging it into the main branch.

Commands:

  • Create a new branch: git branch <branch_name>
  • List all remote or local branches: git branch -a
  • Delete a branch: git branch -d <branch_name>

git checkout:

It is used whenever we start working in a different branch.

Command:

  • Checkout an existing branch: git checkout <branch_name>
  • Checkout and create a new branch with that name: git checkout -b <new_branch>

git merge:

Merging is Git’s way of putting a forked history back together again. The git merge command lets you take the independent lines of development created by the git branch and integrate them into a single branch.

Command: git merge <branch_name>

git remote:

A remote in Git is a common repository that all team members use to exchange their changes. In most cases, such a remote repository is stored on a code hosting service like GitHub or an internal server.

It is used to connect a local repository with a remote repository. A remote repository can have a name set to avoid having to remember the URL of the repository.

Commands:

  • Add remote repository: git remote <command> <remote_name> <remote_URL>
  • The list named remote repositories: git remote -v

Note: A remote repository can have any name. It’s common practice to name the remote repository ‘origin’.

git clone:

The git clone command is used to download an existing Git repository to users’ local computers. Users will then have a full-blown, local version of that Git repo and can start working on the project.

Command: git clone <remote_URL>

git pull:

The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content.

Commands: git pull <branch_name> <remote_URL/remote_name>

git push:

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repository. It requires two parameters: the remote repository and the branch that the push is for.

Commands:

  • Push a specific branch: git push <remote_URL/remote_name> <branch>
  • Push all local branches to the remote repository: git push — all

SOME OPEN SOURCE RESOURCES:

SOME GIT RESOURCES:

--

--