Git keywords every programmer should know

Git keywords every programmer should know

Here are some git keywords that every programmer should know.

🔸Repository

A repository is like a folder for your project. It contains the collection of the file as well as the history of the changes made to those files. Sometimes Github users shorten this as 'repo'

image.png

🔸Branch

A branch is a parallel version of a repository. It is contained within the repository but does not affect the primary or master branch allowing you to work freely without disrupting the 'live' version.
Also, you can merge your branch back into the master branch when you are ready to publish your changes.

image.png

🔸Master

The primary branch of all repositories. All committed and accepted changes should be on the master branch. You can work directly from the master branch, or create other branches.

image.png

🔸Checkout

The git checkout command is used to switch branches in a repository. git checkout master would drop you into the master branch.

image.png

🔸Commit

A commit or revision is like saving; an updated file to its original folder. It is used to record the changes in the repository.

image.png

🔸Push and pull

Push updates a remote branch with the commits made to the current branch. You are literally “pushing” your changes onto the remote. While pull is used to receive data from Github.

image.png

🔸Merge

Taking the changes from one branch and adding them into another (traditionally master) branch. These commits are usually first requested via pull request before being merged by a project maintainer.

image.png

🔸Pull Request

If someone has changed code on a separate branch of a project and wants it to be reviewed to add to the master branch, that someone can put in a pull request.
Pull requests ask the repo maintainers to review the commits made, and then, if acceptable, merge the changes upstream. A pull happens when adding the changes to the master branch.

image.png

🔸Clone

It is used to make a copy of the target repository or clone it, but you can't push changes to the original repo if you are not the project owner.

image.png

🔸Fork

A fork is a rough copy of another user's repository. Forking a repository allows you to freely test and debug with changes without affecting the original project.

image.png

📌Difference between fork and clone

This video explains it simply -
youtu.be/YoGli76EPkU

When you fork a repository, you create a copy of the original repository (upstream repository) but the repository remains on your GitHub account.
Whereas, when you clone a repository, the repository is copied onto your local machine with the help of Git.

🔸Cherry picking

Cherry-picking is the act of picking a commit from a branch and applying it to another.

image.png