Show Menu
Cheatography

GIT and GIT HUB Cheat Sheet (DRAFT) by

Git is an open-source, version control tool created in 2005 by developers working on the Linux operating system; GitHub is a company founded in 2008 that makes tools which integrate with git. You do not need GitHub to use git, but you cannot use GitHub without using git.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Git Commands:

Repository Setup
git init: Initialize a new Git reposi­tory.
git clone <re­pos­ito­ry_­url>: Clone an existing Git reposi­tory.
Committing Changes
git add <fi­le_­nam­e>: Add a file to the staging area.
git commit -m "­<co­mmi­t_m­ess­age­>": Commit changes to the repository with a message.
git status: View the status of the repository and staged files.

Git Commands:

Branching and Merging
git branch: List all branches in the reposi­tory.
git branch <br­anc­h_n­ame>: Create a new branch.
git checkout <br­anc­h_n­ame>: Switch to a different branch.
git merge <br­anc­h_n­ame>: Merge a branch into the current branch.

Git Commands:

Repository Management
git remote add <re­mot­e_n­ame> <re­mot­e_u­rl>: Add a new remote reposi­tory.
git push <re­mot­e_n­ame> <br­anc­h_n­ame>: Push changes to a remote reposi­tory.
git pull <re­mot­e_n­ame> <br­anc­h_n­ame>: Pull changes from a remote reposi­tory.
git log: View commit history.
git diff: View changes between commits.

Git Hub Commands:

Repository Management
git remote add <re­mot­e_n­ame> <re­mot­e_u­rl>: Add a new remote reposi­tory.
git push <re­mot­e_n­ame> <br­anc­h_n­ame>: Push changes to a remote reposi­tory.
git pull <re­mot­e_n­ame> <br­anc­h_n­ame>: Pull changes from a remote reposi­tory.
git clone <re­pos­ito­ry_­url>: Clone an existing reposi­tory.
git fork: Create a fork of a reposi­tory.

Git Hub Commands:

Pull Requests
git pull-r­equest: Create a pull request.
git merge: Merge a pull request.
Issues
git issue: Create a new issue.
git comment: Comment on an issue or pull request.
git assign: Assign an issue to a user.