0% found this document useful (0 votes)
156 views

Git - Cheat .Sheet

This document provides a cheat sheet for common Git commands used for initializing and managing repositories, committing changes, branching, tagging, and pushing/pulling from remote repositories. It lists commands for initializing a local repository, cloning or adding a remote repository, committing changes with messages, pushing and pulling from remote repositories, dropping local changes, creating, checking out, deleting, merging, and pushing branches, creating regular and lightweight tags and tagging specific commits, and deleting local and remote tags.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views

Git - Cheat .Sheet

This document provides a cheat sheet for common Git commands used for initializing and managing repositories, committing changes, branching, tagging, and pushing/pulling from remote repositories. It lists commands for initializing a local repository, cloning or adding a remote repository, committing changes with messages, pushing and pulling from remote repositories, dropping local changes, creating, checking out, deleting, merging, and pushing branches, creating regular and lightweight tags and tagging specific commits, and deleting local and remote tags.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

GIt Cheat Sheet

Initializing a Repository:
git init
Color: green red purple black Meaning: actual shell commands git commands git command attributes user input

Cloning a Remote Repository:


git clone username@host:/path/to/repository

Adding Remote Repository:


git remote add origin username@host:/path/to/repository

Commit:
git add <file> git commit -m "Commit Message" # Use * for all files # Use -a to check in all changes

Push (upload changes to remote repository):


git push origin master

Pull (update from remote repository):


git pull origin master

Drop all local changes and commits:


git fetch origin git reset --hard origin/master git checkout -- <file> # drops only changes for <file>

Branching:
git checkout -b branchname git checkout master git branch -d branchname git push origin branchname git merge branchname # create new branch # switch back to master # delete branch # push branch # merge branchname into current

Tagging:
git tag -a 1.1 -m "tag description" git tag 1.1 git tag 1.1 9fceb02 git push --tags git tag -d 1.0 git push origin :refs/tags/1.0 # regular tag # lightweight tag # tag specific commit # push tags # delete local tag # delete tag from remote

http://terminally-incoherent.com/reference/git-cheat-sheet

@LukeMaciak

2012 Lukasz Grzegorz Maciak

You might also like