DEV Community

Cover image for A Git Cheat Sheet
Baransel
Baransel

Posted on • Updated on

A Git Cheat Sheet

Sign up to my newsletter!.

Intro

When it comes to version control systems, there are few software that can beat GIT in performance and relevance. GIT was developed by Linus Torvalds in 2005 and today, millions of companies use it for efficient code management and version control of their projects. Open source software is available for download for Linux, Windows, Solaris and Mac platforms.

GIT Commands

git config

One of the most used git commands, email, username and file format etc. git config, which can be used to set user-specific configuration values such as the preferred algorithm for example, the following command can be used to set up email:

git config --global user.email root@baransel.dev
Enter fullscreen mode Exit fullscreen mode

git init

This command is used to create a new GIT directory. Sample:

git init
Enter fullscreen mode Exit fullscreen mode

git add

The git add command can be used to add files to the directory. For example, the following command will index a file named README.md located in the local directory:

git add README.md
Enter fullscreen mode Exit fullscreen mode

git clone

The git clone command is used for directory checking purposes.
If the directory is located on a remote server, use:

git clone baransel@91.128.110.48:/path/to/repository
Enter fullscreen mode Exit fullscreen mode

git commit

The git commit command is used to commit changes to the head. Note that not all committed changes will go to the remote directory. Example:

git commit –m "Message related to commit."
Enter fullscreen mode Exit fullscreen mode

git status

The git status command displays a list of files that have not yet been added or that have been changed along with the committed files. Example:

git status
Enter fullscreen mode Exit fullscreen mode

git push

git push is another of the most used basic GIT commands. With a simple push, it pushes the changes made to the master branch of the remote directory associated with the working directory. Example:

git push origin master
Enter fullscreen mode Exit fullscreen mode

git checkout

Continue this post on my blog! A Git Cheat Sheet.

Top comments (0)