Git cheatsheet

Basic

// Initialises a repo on current directory
$ git init

// Lists modifications
git status


// Stage modifications
$ git add {file1} {file2} {filex}

$ git add .  

or 
$ git add --all



// Commit staged stuff
$ git commit -m 'Your commit message'



// Listing remote servers
$ git remote -v



// Set a remote server
$ git remote add {server_name|origin} {server_url}



// Push current branch to a server's target branch
$ git push {server_name|origin} {target_branch_name}



 

Tags

// Creating a new tag on your current HEAD
$ git tag {tag_name}

// List existing tags
$ git tag --list

// Remove a particular tag
$ git tag -d {tag_name}

 

Leave a Reply

Close Menu