GitHub實戰系列匯總:http://www.cnblogs.com/dunitian/p/5038719.html
——————————————————————————————————————————————————————
很多人問,明明有git gui 和 github可以直接圖形化操作的嗎?全部指令干啥???
呃(⊙o⊙)…呃(⊙o⊙)… ===> 裝逼~
O(∩_∩)O~,開玩笑的,其實就是為了通用和熟悉git,linux里面照樣這樣用,多熟悉點基礎指令很有用的,
如果覺得頓時不開心了、無愛了==>推薦你快速入門:http://www.imooc.com/learn/390
———————————————————————————————————————————————————————
創建項目的時候在最下面,添加過濾器,選擇vs 或者把 .gitignore 拷貝一份放git項目文件夾的根目錄
建完就有兩個文件了,.gitignore 是過濾文件
補充:在windows里面直接建立這個文件是不行的,windows最后一個.前面必須有名字(linux里面有.號開頭的文件),除了拷貝再介紹一個方法:
進github,單擊 New File 然后把最下面的過濾文件加進去(ssh的左邊第一個按鈕)
vs的過濾規則貼一下:

1 ## Ignore Visual Studio temporary files, build results, and 2 ## files generated by popular Visual Studio add-ons. 3 4 # User-specific files 5 *.suo 6 *.user 7 *.userosscache 8 *.sln.docstates 9 10 # User-specific files (MonoDevelop/Xamarin Studio) 11 *.userprefs 12 13 # Build results 14 [Dd]ebug/ 15 [Dd]ebugPublic/ 16 [Rr]elease/ 17 [Rr]eleases/ 18 x64/ 19 x86/ 20 build/ 21 bld/ 22 [Bb]in/ 23 [Oo]bj/ 24 25 # Visual Studo 2015 cache/options directory 26 .vs/ 27 28 # MSTest test Results 29 [Tt]est[Rr]esult*/ 30 [Bb]uild[Ll]og.* 31 32 # NUNIT 33 *.VisualState.xml 34 TestResult.xml 35 36 # Build Results of an ATL Project 37 [Dd]ebugPS/ 38 [Rr]eleasePS/ 39 dlldata.c 40 41 *_i.c 42 *_p.c 43 *_i.h 44 *.ilk 45 *.meta 46 *.obj 47 *.pch 48 *.pdb 49 *.pgc 50 *.pgd 51 *.rsp 52 *.sbr 53 *.tlb 54 *.tli 55 *.tlh 56 *.tmp 57 *.tmp_proj 58 *.log 59 *.vspscc 60 *.vssscc 61 .builds 62 *.pidb 63 *.svclog 64 *.scc 65 66 # Chutzpah Test files 67 _Chutzpah* 68 69 # Visual C++ cache files 70 ipch/ 71 *.aps 72 *.ncb 73 *.opensdf 74 *.sdf 75 *.cachefile 76 77 # Visual Studio profiler 78 *.psess 79 *.vsp 80 *.vspx 81 82 # TFS 2012 Local Workspace 83 $tf/ 84 85 # Guidance Automation Toolkit 86 *.gpState 87 88 # ReSharper is a .NET coding add-in 89 _ReSharper*/ 90 *.[Rr]e[Ss]harper 91 *.DotSettings.user 92 93 # JustCode is a .NET coding addin-in 94 .JustCode 95 96 # TeamCity is a build add-in 97 _TeamCity* 98 99 # DotCover is a Code Coverage Tool 100 *.dotCover 101 102 # NCrunch 103 _NCrunch_* 104 .*crunch*.local.xml 105 106 # MightyMoose 107 *.mm.* 108 AutoTest.Net/ 109 110 # Web workbench (sass) 111 .sass-cache/ 112 113 # Installshield output folder 114 [Ee]xpress/ 115 116 # DocProject is a documentation generator add-in 117 DocProject/buildhelp/ 118 DocProject/Help/*.HxT 119 DocProject/Help/*.HxC 120 DocProject/Help/*.hhc 121 DocProject/Help/*.hhk 122 DocProject/Help/*.hhp 123 DocProject/Help/Html2 124 DocProject/Help/html 125 126 # Click-Once directory 127 publish/ 128 129 # Publish Web Output 130 *.[Pp]ublish.xml 131 *.azurePubxml 132 # TODO: Comment the next line if you want to checkin your web deploy settings 133 # but database connection strings (with potential passwords) will be unencrypted 134 *.pubxml 135 *.publishproj 136 137 # NuGet Packages 138 *.nupkg 139 # The packages folder can be ignored because of Package Restore 140 **/packages/* 141 # except build/, which is used as an MSBuild target. 142 !**/packages/build/ 143 # Uncomment if necessary however generally it will be regenerated when needed 144 #!**/packages/repositories.config 145 146 # Windows Azure Build Output 147 csx/ 148 *.build.csdef 149 150 # Windows Store app package directory 151 AppPackages/ 152 153 # Others 154 *.[Cc]ache 155 ClientBin/ 156 [Ss]tyle[Cc]op.* 157 ~$* 158 *~ 159 *.dbmdl 160 *.dbproj.schemaview 161 *.pfx 162 *.publishsettings 163 node_modules/ 164 bower_components/ 165 166 # RIA/Silverlight projects 167 Generated_Code/ 168 169 # Backup & report files from converting an old project file 170 # to a newer Visual Studio version. Backup files are not needed, 171 # because we have git ;-) 172 _UpgradeReport_Files/ 173 Backup*/ 174 UpgradeLog*.XML 175 UpgradeLog*.htm 176 177 # SQL Server files 178 *.mdf 179 *.ldf 180 181 # Business Intelligence projects 182 *.rdl.data 183 *.bim.layout 184 *.bim_*.settings 185 186 # Microsoft Fakes 187 FakesAssemblies/ 188 189 # Node.js Tools for Visual Studio 190 .ntvs_analysis.dat 191 192 # Visual Studio 6 build log 193 *.plg 194 195 # Visual Studio 6 workspace options file 196 *.opt
擴展:(可以自己添加過濾文件/規則)
忽略文件
一般我們總會有些文件無需納入 Git 的管理,也不希望它們總出現在未跟蹤文件列表。 通常都是些自動生成的文件,比如日志文件,或者編譯過程中創建的臨時文件等。 在這種情況下,我們可以創建一個名為
.gitignore
的文件,列出要忽略的文件模式。 來看一個實際的例子:$ cat .gitignore *.[oa] *~
第一行告訴 Git 忽略所有以
.o
或.a
結尾的文件。一般這類對象文件和存檔文件都是編譯過程中出現的。 第二行告訴 Git 忽略所有以波浪符(~)結尾的文件,許多文本編輯軟件(比如 Emacs)都用這樣的文件名保存副本。 此外,你可能還需要忽略 log,tmp 或者 pid 目錄,以及自動生成的文檔等等。 要養成一開始就設置好 .gitignore 文件的習慣,以免將來誤提交這類無用的文件。文件
.gitignore
的格式規范如下:
所有空行或者以
#
開頭的行都會被 Git 忽略。可以使用標准的 glob 模式匹配。
匹配模式可以以(
/
)開頭防止遞歸。匹配模式可以以(
/
)結尾指定目錄。要忽略指定模式以外的文件或目錄,可以在模式前加上驚嘆號(
!
)取反。所謂的 glob 模式是指 shell 所使用的簡化了的正則表達式。 星號(
*
)匹配零個或多個任意字符;[abc]
匹配任何一個列在方括號中的字符(這個例子要么匹配一個 a,要么匹配一個 b,要么匹配一個 c);問號(?
)只匹配一個任意字符;如果在方括號中使用短划線分隔兩個字符,表示所有在這兩個字符范圍內的都可以匹配(比如[0-9]
表示匹配所有 0 到 9 的數字)。 使用兩個星號(*
) 表示匹配任意中間目錄,比如`a/**/z` 可以匹配a/z
,a/b/z
或 `a/b/c/z`等。