What is Git ?

Why is it called Git ?

Torvalds sarcastically quipped about the name git (which means “unpleasant person” in British English slang): “I’m an egotistical bastard, and I name all my projects after myself.

Why Git ?

Version control is the only reasonable way to keep track of changes in code, manuscripts, presentations, and data analysis projects. I used to make numbered tar.gz files for a project. But exploring the differences is difficult, to say the least. And if you use git properly, you’ll have annotated each small change. Merging collaborators’ changes made easy. Have you ever had to deal with a collaborator sending you modifications distributed across many files, or had to deal with two people having made changes to the same file at the same time? Painful. git merge is the answer.

Why use Github?

Github is like facebook for programmers. Everyone’s on there. You can look at what they’re working on and easily peruse their code and make suggestions or changes. It’s really open source. “Open source” is not so open if you can’t easily study it. With github, all of the code is easily inspected, as is its entire history.

What are the benefits of using version control?

Having a GitHub repo makes it easy for you to keep track of collaborative and personal projects — all files necessary for certain analyses can be held together and people can add in their code, graphs, etc. as the projects develop. Each file on GitHub has a history, making it easy to explore the changes that occurred to it at different time points. You can review other people’s code, add comments to certain lines or the overall document, and suggest changes. For collaborative projects, GitHub allows you to assign tasks to different users, making it clear who is responsible for which part of the analysis. You can also ask certain users to review your code. For personal projects, version control allows you to keep track of your work and easily navigate among the many versions of the files you create, whilst also maintaining an online backup.

Basic Git commands

git init

git status

* Mostly, it is used to display the state between Git Add and Git commit command.

git add

git commit -m

git log

  • To see it more regularly git log — pretty=oneline is used.

git show

What Is BRANCH Concept?

git branch

git checkout

git branch -d

git merge

  • Master always represents main project.

How Does Git Reset Work?

  • git reset --soft, which will keep your files, and stage all changes back automatically.
  • git reset --mixed, which is the default, and keeps all files the same but unstages the changes. This is the most flexible option, but despite the name, it doesn’t modify files.

Should You Ever Hard Reset?

You should really only be using soft or mixed resets, but, if you messed up your repository so bad that you need to completely reset it, you can use the following sequence of commands to fully set it back to normal.

How to use ?

As seen below, after getting log record number with git log command we can see many records in there.


git push origin master

Pull Request

  • git checkout -b new_branch provides creating new branch and getting into new branch. Easy way.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store