Skip to content

Git Cheat Sheet

Git-Demo.png

Introduction

Git is a popular version control system used by developers all over the world. It is a powerful tool that allows developers to track changes to their code and collaborate with others. However, with so many commands and options, it can be overwhelming. That’s why many developers use a Git cheat sheet to help them remember the most common commands and their syntax.

Basic Commands

The following are some of the most basic Git commands that every developer should know:

  • git init: Initializes a new Git repository.
  • git add: Adds changes to the staging area.
  • git commit: Commits changes to the repository.
  • git status: Shows the status of the repository.
  • git log: Shows the commit history.

Branching and Merging

One of the most powerful features of Git is its branching and merging capabilities. The following are some of the most important commands for branching and merging:

  • git branch: Lists all branches in the repository.
  • git checkout: Switches to a different branch or commit.
  • git merge: Merges changes from one branch into another.

Collaboration and Remote Repositories

Git is designed for collaboration, and it’s important to know how to work with remote repositories. The following are some of the most important commands for collaboration and remote repositories:

  • git clone: Copies a repository from a remote server.
  • git pull: Downloads changes from a remote repository.
  • git push: Uploads changes to a remote repository.
  • git remote: Lists all remote repositories.

git-cheat-sheet-1.png

git-cheat-sheet-2.png

Resources

  • gitlab version(https://about.gitlab.com/images/press/git-cheat-sheet.pdf)
  • github version(https://education.github.com/git-cheat-sheet-education.pdf)
  • https://dev.to/doabledanny/git-cheat-sheet-50-commands-free-pdf-and-poster-4gcn
Feedback







Disclaimer
  • Welcome to visit the knowledge base of SRE and DevOps!
  • License under CC BY-NC 4.0
  • Made with Material for MkDocs and improve writing by generative AI tools
  • Copyright issue feedback me#imzye.com, replace # with @