Skip to content

Instantly share code, notes, and snippets.

@bryhaw
bryhaw / git add -A
Created February 10, 2014 00:53
Git: Adding and removing untracked/tracked files
git add -A" is equivalent to "git add .; git add -u
The important point about "git add ." is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.
"git add -u" looks at all the currently tracked files and stages the changes to those files if they are different or if they have been removed. It does not add any new files, it only stages changes to already tracked files.
"git add -A" is a handy shortcut for doing both.
Source: http://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add
@bryhaw
bryhaw / Git: Remove untracked files
Created February 6, 2014 06:03
Git: Remove untracked files
git clean -f
Use -n or --dry-run to preview (no going back)
If you want to also remove directories, run git clean -f -d
If you just want to remove ignored files, run git clean -f -X
If you want to remove ignored as well as non-ignored files, run git clean -f -x
@bryhaw
bryhaw / Git: Discard unstaged changes
Created February 6, 2014 06:01
Git: Discard unstaged changes
git stash save --keep-index
git stash drop
@bryhaw
bryhaw / PM: Add-Migration
Created February 6, 2014 06:00
Add a migration after updating model through Package Manager
Add-Migration [Migration_Name]
@bryhaw
bryhaw / PM: Update-Database
Created February 6, 2014 05:56
Update database through package manager after Model update
Update-Database