Skip to content

Instantly share code, notes, and snippets.

@daveaseeman
Last active August 29, 2015 14:13
Show Gist options
  • Save daveaseeman/4c763f4fef1023357294 to your computer and use it in GitHub Desktop.
Save daveaseeman/4c763f4fef1023357294 to your computer and use it in GitHub Desktop.
Popular git commands and workflows, with instructions

Frequent Git Commands and Workflows

Commit and Push Code

git add -A
git commit -am 'commit message'
git push

###Remove Files in Repository

$ git rm -r [filename]

###Create .gitignore

$ vim .gitignore

- Write which folders or directories want to be ignored
.sass-cache

###Pull to Public Directory

- Move to pub directory & create git
$ git init

- Connect to repository on github
$ git remote add origin [email protected]:[userName]/[projectName].git

- Pull files
$ git pull origin master

##Revert to Previous Commit (permanently)

- reset code to old commit
git reset --hard <old-commit-id>

- push changes to repository
git push -f origin <branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment