< Lets Git to it >_

I know using git especially as a command line interface can be quite daunting in the beginning. But understanding a few commands can actually get you running and using it very quickly. Lets start with understanding about git :-

What is Git?

Git is a distributed, open-source version control system (VCS) that enables you to store code, track revision history, merge code changes, and revert to earlier code version when needed.

What does it do?

Git stores your source code and its full development history locally in a repository. You can create a copy of your source code, known as a branch, which you can then work on in parallel to the main version. When you are ready, you can commit changes to save your progress. Or you can merge your branch back into the main version. Every time you commit, Git takes a snapshot of your work and compares it to previous versions with a viewable operation called a diff. If there’s been a change from previous commits, Git stores a new snapshot in the repository.

What Are the Benefits of Git?

Git has several key benefits:

  • Historical Change Tracking You can review a graph of how your commits have changed over time, see when and by whom changes were made, and revert to a previous commit if needed. This history makes it easier to identify and fix bugs.
  • Work as a Team You can easily share your code with teammates for review before you commit or merge back to the main working branch. Additionally, the branching and review capabilities enable simultaneous development. Multiple people can work on the same file and resolve differences later.
  • Improve Team Speed & Productivity — Git makes it easy for your team to track changes to your code. Now you can focus on writing code instead of spending time tracking and merging different versions across your team. Additionally, Git performs computations and stores your main repository locally, making it quicker on most operations than a centralised VCS.
  • Availability and Redundancy — Git is a distributed VCS, meaning there is no single, central place where everything is stored. In a distributed system, there are multiple backups in the event that you need one. This approach also means that you can work offline and commit your changes when you’re ready.
  • Git Is the Industry Standard — Due to its popularity, Git is supported by many integrated development environments (IDEs) and many popular developer tools including AWS CodeCommit, Jenkins, and Travis. There are many free Git resources available, such as the Git open source page.

Source: Amazon AWS.

Now coming to the commands that will help you get started —

  1. Initialize the current directory as a Git repository.

2. Create a local copy of a repository from a hosted location via URL.

3. Switch to another branch and check it out into your working directory.

4. Shows a list of modified files in your working directory and when they are staged for the next commit.

5. Commit your staged content as a new commit snapshot with specified message.

6. Display a list of branches with an asterisk (*) next to the active branch.

7. Create a new branch.

8. Add changes from a specific file to the stage, ready for your next commit.

9. Add changes from all files to the stage, ready for your next commit.

10. Unstage a specific file, while still retaining the changes in the working directory.

11. Unstage all files, while still retaining the changes in the working directory.

Hopefully this is something that can help you get started and get comfortable with Git :).

Happy Coding.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Machine Learning Model in a Docker Container

Applying Open Source contribution model at Xendit and building a better engineering culture

Deployment with Vercel — Part #10B of 11

Intro to Swift The Final Chapter

OOP Series — What is an Object?

First Try at GraphQL & Apollo

Making Loops In C++

System Design Interview Prep: Spotify Real-Time Player

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
Karan Mann

Karan Mann

More from Medium

Software engineering principles, best practices & introduction to JavaScript.

How To Use Promises In Sequelize

Front-end buried point — Error monitoring

My first days using Linux