Git 有没有简单的方法可以使用Visual Studio 2013压缩我的源代码?

Git 有没有简单的方法可以使用Visual Studio 2013压缩我的源代码?,git,visual-studio-2013,zip,pkzip,Git,Visual Studio 2013,Zip,Pkzip,在创建新的VisualStudio项目以试用各种技术或周末项目时,我需要一种简单的方法来压缩我的源代码,而不必担心.pdb、obj/bin文件等 多年前,我提出了一组.bat文件,其中之一是: zipall.bat看起来像这样: del all.zip pkzip -add -excl=Backup\* -path -rec all del/f/s/q *.aps 2>nul del/f/s/q *.bsc 2>nul del/f/s/q *.exp

在创建新的VisualStudio项目以试用各种技术或周末项目时,我需要一种简单的方法来压缩我的源代码,而不必担心.pdb、obj/bin文件等

多年前,我提出了一组.bat文件,其中之一是: zipall.bat看起来像这样:

del all.zip
pkzip -add -excl=Backup\* -path -rec all
del/f/s/q *.aps        2>nul
del/f/s/q *.bsc        2>nul
del/f/s/q *.exp        2>nul
del/f/s/q *.idb        2>nul
del/f/s/q *.ilk        2>nul
del/f/s/q *.lib        2>nul
del/f/s/q *.ncb        2>nul
del/f/s/q *.obj        2>nul
del/f/s/q *.opt        2>nul
del/f/s/q *.pch        2>nul
del/f/s/q *.pdb        2>nul
del/f/s/q *.plg        2>nul
del/f/s/q *.sbr        2>nul
del/f/s/q *.suo        2>nul
del/f/s/q *.sdf        2>nul

del/f/s/q /ah *.suo        2>nul

del/f/s/q BuildLog.htm    2>nul

for /f "delims=;" %%i in ('dir "TempPE" /s/b /ad')         do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "obj" /s/b /ad')            do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "_ReSharper*" /s/b /ad')    do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "TestResults*" /s/b /ad')   do rmdir /s/q "%%i"
mkdir Backup 2>nul
if not exist all.zip goto :eof
set datex=%date:/=-%
set timex=%time::=-%
set filename="Backup\%datex% %timex%.zip"
copy all.zip %filename%
在运行它之前,我将运行另一个批处理文件: 清洁。蝙蝠看起来像这样:

del all.zip
pkzip -add -excl=Backup\* -path -rec all
del/f/s/q *.aps        2>nul
del/f/s/q *.bsc        2>nul
del/f/s/q *.exp        2>nul
del/f/s/q *.idb        2>nul
del/f/s/q *.ilk        2>nul
del/f/s/q *.lib        2>nul
del/f/s/q *.ncb        2>nul
del/f/s/q *.obj        2>nul
del/f/s/q *.opt        2>nul
del/f/s/q *.pch        2>nul
del/f/s/q *.pdb        2>nul
del/f/s/q *.plg        2>nul
del/f/s/q *.sbr        2>nul
del/f/s/q *.suo        2>nul
del/f/s/q *.sdf        2>nul

del/f/s/q /ah *.suo        2>nul

del/f/s/q BuildLog.htm    2>nul

for /f "delims=;" %%i in ('dir "TempPE" /s/b /ad')         do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "obj" /s/b /ad')            do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "_ReSharper*" /s/b /ad')    do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "TestResults*" /s/b /ad')   do rmdir /s/q "%%i"
mkdir Backup 2>nul
if not exist all.zip goto :eof
set datex=%date:/=-%
set timex=%time::=-%
set filename="Backup\%datex% %timex%.zip"
copy all.zip %filename%
我必须定期用新工具引入的扩展来更新列表

顺便提一下,pkzip中使用“excl=Backup*”选项的原因是为了维护zip文件的备份backup.bat如下所示:

del all.zip
pkzip -add -excl=Backup\* -path -rec all
del/f/s/q *.aps        2>nul
del/f/s/q *.bsc        2>nul
del/f/s/q *.exp        2>nul
del/f/s/q *.idb        2>nul
del/f/s/q *.ilk        2>nul
del/f/s/q *.lib        2>nul
del/f/s/q *.ncb        2>nul
del/f/s/q *.obj        2>nul
del/f/s/q *.opt        2>nul
del/f/s/q *.pch        2>nul
del/f/s/q *.pdb        2>nul
del/f/s/q *.plg        2>nul
del/f/s/q *.sbr        2>nul
del/f/s/q *.suo        2>nul
del/f/s/q *.sdf        2>nul

del/f/s/q /ah *.suo        2>nul

del/f/s/q BuildLog.htm    2>nul

for /f "delims=;" %%i in ('dir "TempPE" /s/b /ad')         do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "obj" /s/b /ad')            do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "_ReSharper*" /s/b /ad')    do rmdir /s/q "%%i"
for /f "delims=;" %%i in ('dir "TestResults*" /s/b /ad')   do rmdir /s/q "%%i"
mkdir Backup 2>nul
if not exist all.zip goto :eof
set datex=%date:/=-%
set timex=%time::=-%
set filename="Backup\%datex% %timex%.zip"
copy all.zip %filename%
由于VisualStudio2013内置了Git,我再也不用担心备份了


在Visual Studio 2013中创建新项目时,如果指定“创建新Git存储库”,它将创建一个隐藏的.gitignore文件,该文件比我的clean.bat更详尽。有没有一种方法可以将该列表与pkzip一起使用,以便在压缩时忽略.gitignore中的文件?

当您在选中“创建新Git存储库”的情况下创建Visual Studio项目时,会创建.gitignore文件

您不需要使用pkzip,因为Git内置了归档功能

仅键入: git归档文件-o all.zip头


它将创建最新源代码的所有.zip文件,而不包含在.zip文件中不需要的任何内容,如bin、obj、exes、nuget程序集等。

当您在选中“创建新Git存储库”的情况下创建Visual Studio项目时,将创建.gitignore文件

您不需要使用pkzip,因为Git内置了归档功能

仅键入: git归档文件-o all.zip头

它将创建最新源代码的all.zip,而不包含.zip文件中不需要的任何内容,如bin、obj、exes、nuget assemblies等。

(这是一个自我回答的问题。请参阅)(这是一个自我回答的问题。请参阅)