DEV Community

Cover image for Basic Git commands for beginners

Basic Git commands for beginners

Nirbhay Parmar
I am a budding web developer. Currently a grad student at Pandit Deendayal Petrolium University, Gandhinagar.
・2 min read

Hello everyone!!

I am Nirbhay Parmar and I am a learning web developer. In this post I will be explaining some basic Git terminologies which is useful if you are entering into development field or want to contribute in any open source project on Github.

Now the first question arises from this introduction is that what is Git and why should I even care about it? Some of the beginners are also confused between Git and Github. So let me explain the Git first then I will explain about Github after it.

Git is a version controlling software. It is used by developers for maintaining different versions of any project they are working on. In an ongoing development process there are many developers working on a single project. They are working with one or two features of that project. So they need a system that can keep track of the changes and commits made on a project and if someone broke the code while experimenting on any feature then there should a way to reverse that faulty code. So Git does the same. Git keep track on files and code used in a project and give a way to make different versions of same projects called "branches" to experiment without worrying about breaking the code.

Now what is Github? Github is a place to store your code or your repository online to share it with your team or online. All open source projects are on Github and any who knows how to code can contribute to it. Another such service are Bitbucket and Gitlab.

Now some basic Git commands-

  1. Git init - Git init is used to initiate a local git repository. It is first command whenever we want to use git.

  2. Git status - It shows the status of the working tree. Git status is used to show the changes made, any newly created file that is not added to repo.

  3. Git add - As the name suggests it used add new files and folders to git.

  4. Git commit - It is used to save changes to the repository.

  5. Git clone - It is used to setup a local git repo using any other remote git repo hosted on Github or Bitbucket.

  6. Git push - It is used to push commits to your remote repo.

  7. Git pull - It is used to fetch changes made by others to remote repo to your local repo.

So these are some common Git commands which we can use in your projects.

There are so many other commands which I will discuss in upcoming parts of this series.

Discussion (4)

bobbyiliev profile image
Bobby Iliev

Very good up to the point list!

For more details I could suggest this free opensource eBook here:

GitHub logo bobbyiliev / introduction-to-git-and-github-ebook

Free Introduction to Git and GitHub eBook

πŸ’‘ Introduction to Git and GitHub

This is an open-source introduction to Git and GitHub guide that will help you learn the basics of version control and start using Git for your SysOps, DevOps, and Dev projects. No matter if you are a DevOps/SysOps engineer, developer, or just a Linux enthusiast, you can use Git to track your code changes and collaborate with other members of your team or open source maintainers.

The guide is suitable for anyone working as a developer, system administrator, or a DevOps engineer and wants to learn the basics of Git, GitHub and version control in general.

πŸš€ Download

To download a copy of the ebook use one of the following links:

πŸ“˜ Chapters

  • About the book
  • Introduction to Git
  • Version Control
  • Installing Git
  • Basic Shell Commands
  • Git Configuration
  • Introduction to GitHub
  • Initializing a Git project
  • Git Status
  • Git Add
  • Git…
nirbhayparmar profile image
Nirbhay Parmar Author

Thank you so much for your comment.

I will read your ebook for sure.

fakhrulhilal profile image
Fakhrulhilal Maktum

I think, you need to compare with centralized vcs like svn, what is git trying to solve. I believe some big companies (like Microsoft), migrate to git with a reason.