Skip to main content

Command Palette

Search for a command to run...

Open Source

START EMBARKING YOUR JOURNEY OF OPEN-SOURCE

Updated
6 min readView as Markdown
Open Source
P

I m sophomore in be cse. I was from non tech background till 12 but technology attracts me the way it is,hence exploring different tech stacks.

Nowadays, everyone is using the terms opensource, git, GitHub, DevOps, docker, so what are they?

What is open source?

It refers to any program whose source code is made available for use or modification as users or other developers see fit.

What are the examples of open source?

LINUX, KUBERNETES

What is GIT?

It is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different computers).

What is the importance of OSS culture?

  1. By allowing anybody to access, evaluate and alter the source code, open source encourages greater transparency and security.

  2. This increases the software’s overall security and stability by allowing developers and security professionals to find and repair bugs and security vulnerabilities more rapidly.

  3. Developers can collaborate from Punjab to California on any project.

  4. Developers can pull /push from local machines to remote repositories where it can be accessible worldwide

    What is DevOps?

    The combination of cultural philosophies, practices, and tools that increases an organization's ability to deliver applications and services at high velocity

LET'S DIRTY YOUR HANDS WITH PRACTICAL USE

So, now the question arises, this all is theoretical knowledge we can get it by searching too.....

But, How we can push our local machine projects to a place where it is accessible to everyone? , Where we can see others' projects and make the changes to the project made in California?

Here's what You Want --> The Knowledge Of GIT HUB

What is GIT HUB?

is a platform and cloud-based service for software development and version control using Git, allowing developers to store and manage their code It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, and continuous integration for every project.

Let's start the open-source journey with some commands:

Now we will discuss some steps:

STEP 1: Install Git (allow access)and Github(make your profile)

STEP 2: Now go on git bash by clicking on the desktop

STEP 3:**RUN THE COMMANDS IN GIT BASH**

git config --global user.name "some name"

git config --global user.email "some email"

git config --list(all hidden files)

STEP 4: Now open git hub name a repository

choose options like README.gitignore,private/public according to your project demands.

STEP 5: IF YOU WANT REMOTE REPO TO LOCAL MACHINE

-->git clone<link>

The project will clone to the local machine

-->cd <folder name>

it is the current directory

cd ..

it is to go back to the desktop, the current directory shifts to the desktop

-->ls

it will list all the files

ls -a

to list all the hidden files

--> clear

it will clear the editor

-->git log/log --oneline

it will show you the history of the last or every commit which you have made

--> git ignore

all the files that you have inside the git ignore folder (by using.<name >(Of something common/extension which you do not want to include)) will be ignored.

-->git status

to check the status of files, it is untracked(red), modified(green) , tracked(committed)

-- (working tree clean), undo (reset/revert)

-->git add <folder>

To add the changes to the folder

it will be modified but not committed in the file/folder until you commit the changes.

--> git add.

it is the shortcut to add all the changes rather than individually adding it.

-->git commit -m "some message"

to take the snapshot of the change, you made, save it in memory permanently until you (undo changes by resetting or reverting)

-->git push origin main

** We use origin for default

** We use main (as branch)

It pushes the changes from the local repository to the remote folder/repository

-->mkdir (new folder)

for making a new folder

Is the commit permanent?

Answer is NO

you can change the messages in the commit by

resetting it with the command

-->git reset <link of commit >

(helps in undoing changes)

Search for more reset options HEAD/SOFT/MIXED

-->git revert <link of commit>

(helps in reverting the commit without passing in modified mode)

Try git revert -n

###Sometimes automatically editor comes in the way, but you can escape that interface by typing :q

How to clone someone's other project to a local machine?

Go to their repository on GitHub

click fork button

now it will appear on your repository list

clone it, make some changes(add it, commit), and push the changes into your remote repository of that particular project.

--> fork

it is the button in one's repository to make a copy of the source code to file under your repository list.

How to push your desktop folder to GitHub as a remote repository?

--> Open the file in vs, use several commands as:

--> git init (to initialize the folder in git)

make a remote repository on the git hub where you want this local machine file to post

--> git remote add origin <link>

(The link should be to a remote repository where you want to fetch the local machine

folder)

--> git remote -v

(it pushes and fetches the file)

you can check the branch

--> git branch

if it is master you can change it to the main

by

--> git branch -M main

(to rename it )

now finally push to the remote repository

--> git push (if you set upstream by the command )

git push -u origin main

NOW OPEN GIT HUB AND THAT REPOSITORY SEE THE MAGIC!!!

What are branches? What is their use?

if we want to make a change in the repository we will not first make it in the main we will make some changes in one branch and another in other branches, and then we will merge it in the main.

How to make a branch? how do shift from one to another branch?

we will use some commands:

-->git checkout -b <new branch>

to make a new branch

--> git branch -M main

(to rename it)

--> git branch

(to check we are in which branch)

--> git checkout <branch name>

(to navigate the branches)

--> git branch -d <branch name>

(to delete branch)

We make branches as it helps in merging things:

How to merge? what are merging conflicts? How to resolve it? How to create pull requests PR?

NOW, ASSUME you have two branches:

FIRST WAY TO MERGE:

--> main and feature 1(you made)

GO on feature1, made some changes

--> git diff main

(all the differences will be shown)

--> git merge main

(all the additions will be done )

now push it on the remote by using the push command

but sometimes problems come when we want to modify something in original content

SECOND WAY TO MERGE:

By creating a pull request

-->PR

(tells others about changes you have pushed to branch in the repository)

now if merged (on git) you want it local machine

use :

--> git pull origin main

(use to fetch and download content from a remote repository)

How to Delete a Repository or change the visibility of a Repository?

Go in that repository

Go to Settings

Go to Danger Zone

and make changes accordingly or delete it.

Practice makes a man perfect ---> MAYBE NOT (controversial)

But Definitely,

Practice makes a lot of Improvement-->(by Pinak)


So Keep Practicing these commands...

Happy learning,☺️

Subscribe for more...