Skip to content

Instantly share code, notes, and snippets.

@SimoPrG
Last active May 27, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimoPrG/9b42b3588eafca90b052bea7418689bf to your computer and use it in GitHub Desktop.
Save SimoPrG/9b42b3588eafca90b052bea7418689bf to your computer and use it in GitHub Desktop.
git commands
//Discard all changes in the working directory
git checkout *
//Add all changes to the commit
git add -A
//Add all changes in the tracked files and commit
git commit -am "Commit message"
// List branches
git branch //(or 'git branch --list') list all local branches
git branch -r //(or 'git branch --list -r') list all remote branches
git branch -a //(or 'git branch --list -a') list all branches
// create new branch and select it
git checkout -b "BranchName"
// push local branch and set it to track the remote one
git push [-u | --set-upstream] origin local-branch-name
// Stop tracking remote branch and delete it locally
git branch --unset-upstream <branchname> // Removes the upstream information for the current branch
git branch -d -r origin/<branchname> // Delete remote tracking branch
git checkout master // Select master branch
git branch -d <branchname> // Delete local branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment