DEV Community

loading...
Cover image for GIT Basics / Cheatsheet

GIT Basics / Cheatsheet

Andre Reus
Full Stack Web and App Developer
・2 min read

What is GIT?

Best short and also official description:

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Benefits / Comparison:

Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Setup

Download and install it from https://git-scm.com/

GIT Commands

Basic Commands

git status // Show the current status
git init // Initialize project folder with GIT
git add // Add changes to the stage
git commit // Commit changes in the stage to the history / log
git log // Show the commit history
Enter fullscreen mode Exit fullscreen mode

GIT Help

git help // Help Overview
git help -a // GIT Commands
git help -g // GIT Guides
Enter fullscreen mode Exit fullscreen mode

GIT Branching visually illustrated

GIT Branching

Branching Commands

git branch // Create a branch
git checkout (in future "git switch") // Switch to a branch
git merge // Merge a branch into an other one
Enter fullscreen mode Exit fullscreen mode

Playground for GIT Commands: https://git-school.github.io/visualizing-git/

GIT Client (GUI)

GIT Client

Some good free GIT Clients (GUIs) are:

Optional useful Diff Tool: Beyond Compare

Collaboration (or cloud backup)

Visually illustrated

GIT Collaboration

Hosting services

Collaboration Commands

git clone // Download a repository to your PC
git fetch // Download the latest content from the server
git pull // Download the latest content from the server and merge it with your local content
git push // Upload your content to the server
Enter fullscreen mode Exit fullscreen mode

Useful Links

Discussion (0)