Git is a distributed version control system that helps developers collaborate on projects of any scale.

Linus Torvalds, the developer of the Linux kernel, created Git in 2005 to help control the Linux kernel’s development.

What is a Distributed Version Control System?

A distributed version control system is a system that helps you keep track of changes you’ve made to files in your project.

This change history lives on your local machine and lets you revert to a previous version of your project with ease in case something goes wrong.

Git makes collaboration easy. Everyone on the team can keep a full backup of the repositories they’re working on on their local machine. Then, thanks to an external server like BitBucket, GitHub or GitLab, they can safely store the repository in a single place.

This way, different members of the team can copy it locally and everyone has a clear overview of all changes made by the whole team.

Git has many different commands you can use. And I’ve found that these fifty are the ones I use the most often (and are therefore the most helpful to remember).

So I have written them down and thought it’d be nice to share them with the community. I hope you find them useful – Enjoy.

  • How to check your Git configuration
  • How to setup your Git username
  • How to setup your Git user email
  • How to cache your login credentials in Git
  • How to initialize a Git repo
  • How to add a file to the staging area in Git
  • How to add all files in the staging area in Git
  • How to add only certain files to the staging area in Git
  • How to check a repository’s status in Git
  • How to commit changes in the editor in Git:
  • How to commit changes with a message in Git
  • How to commit changes (and skip the staging area) in Git
  • How to see your commit history in Git
  • How to see your commit history including changes in Git
  • How to see a specific commit in Git
  • How to see log stats in Git
  • How to see changes made before committing them using “diff” in Git
  • How to see changes using “git add -p”
  • How to remove tracked files from the current working tree in Git
  • How to rename files in Git
  • How to ignore files in Git
  • How to revert unstaged changes in Git
  • How to revert staged changes in Git
  • How to amend the most recent commit in Git
  • How to rollback the last commit in Git
  • How to rollback an old commit in Git
  • How to create a new branch in Git
  • How to switch to a newly created branch in Git
  • How to list branches in Git
  • How to create a branch in Git and switch to it immediately
  • How to delete a branch in Git
  • How to merge two branches in Git
  • How to show the commit log as a graph in Git:
  • How to show the commit log as a graph of all branches in Git
  • How to abort a conflicting merge in Git
  • How to add a remote repository in Git
  • How to see remote URLs in Git
  • How to get more info about a remote repo in Git
  • How to push changes to a remote repo in Git
  • How to pull changes from a remote repo in Git
  • How to check remote branches that Git is tracking
  • How to fetch remote repo changes in Git
  • How to check the current commits log of a remote repo in Git
  • How to merge a remote repo with your local repo in Git
  • How to get the contents of remote branches in Git without automatically merging
  • How to push a new branch to a remote repo in Git
  • How to remove a remote branch in Git
  • How to use Git rebase
  • How to run rebase interactively in Git
  • How to force a push request in Git

#git #github #developer #programming

Git Cheat Sheet – 50 Git Commands You Should Know
2.25 GEEK