Git is a vast VCS (Version Control System) that gives you the ability to work projects with teams in a very unique way. There are tons of commands and functions to learn. Getting to know and understand how to use Git properly can only happen over time. If you understand what Git is and how it works, then you will have a better understanding of the Git cheat sheet below.
GitHub provides desktop clients that include a graphical user interface for the most common repository actions and an automatically updating command line edition of Git for advanced scenarios.
Here is a little Git cheat sheet for you to reference for all things Git.
GitHub Desktop and Platform Installations
Find the GitHub desktop here: https://desktop.github.com/
You can find Git for any platforms here: https://git-scm.com/
If you want to know how to install Git on any platform please review these detailed articles:
Configure Tooling Commands
Some commands to configure user information for all local repositories.
This sets the name you want attached to your commit transactions.
This sets the email you want attached to your commit transactions.
Some commands to start a new repository or obtain one from an existing URL.
This command creates a new local repository with the specified name.
This command downloads a project and its entire version.
For more information on repositories please review the following articles:
Refactor File Names
Some commands to relocate and remove versioned files.
This command deletes the file from the working directory and stages the deletion.
This command removes the file from version control but preserves the file locally.
This command changes the file name and prepares it for commit.
Exclude temporary files and paths.
A text file named .gitignore suppresses accidental versioning of files and paths matching the specified patterns.
This command lists all ignored files in the project.
Commands to shelve and restore incomplete changes.
This will temporarily store all modifies tracked files.
This command restores the most recently stashed files.
This command lists all stashed changesets.
This command discards the most recently stashed changeset.
Commands for reviewing edits and crafting a commit transaction.
This command lists all new or modified files to be committed.
This command shows file differences that are not yet staged.
This command snapshots the file in preparation for versioning.
This command shows file differences between staging and the last file version.
This command unstages the file, but preserves its contents.
This command records file snapshots permanently in version history.
This command lists all local branches in the current repository.
This command creates a new branch.
This command switches to the specified branch and updates working directory.
This command combines the specified branch’s history into the current branch.
This command will delete a specified branch.
Here are some commands that will allow you to browse and inspect the the evolution of project files.
This command lists version history for the current branch.
This command lists version history for the file, including renames.
This command shows content differences between two branches.
This command outputs metadata and content changes of the specified commit.
Some commands to erase mistakes.
This command Undoes all commits after [commit], preserving changes locally.
This command discards all history and changes back to the specified commit.
Some commands to register a remote (URL) and exchange repository history.
This command downloads all history from the remote repository.
This command combines the remote branch into the current local branch.
This command uploads all local branch commits to GitHub.
This command downloads bookmark history and incorporates changes.
A Little More
For an overview of even more top Git commands and examples view this article:
For more detailed information on how to undo changes in Git please read:
There you go. A little Git cheat sheet to help you on your journey.
Author: Jeremy Holcombe
Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks.