原文:http://codingdict.com/article/21405Git
刪除操作
Tom更新了他的本地存儲(chǔ)庫(kù),并在src目錄中找到了已編譯的二進(jìn)制文件。在查看提交消息后,他意識(shí)到編譯的二進(jìn)制文件是由Jerry添加的。
[tom@CentOSsrc]$pwd/home/tom/project/src[tom@CentOSsrc]$lsMakefilestring_operationsstring_operations.c[tom@CentOSsrc]$filestring_operationsstring_operations:ELF64-bitLSBexecutable,x86-64,version1(SYSV),dynamicallylinked(usessharedlibs),forGNU/Linux2.6.18,notstripped[tom@CentOSsrc]$gitlogcommit29af9d45947dc044e33d69b9141d8d2dad37cc62Author:JerryMouse<jerry@codingdict.com>Date:WedSep1110:16:252013+0530AddedcompiledbinaryVCS僅用于存儲(chǔ)源代碼,而不用于存儲(chǔ)可執(zhí)行二進(jìn)制文件。因此,Tom決定從存儲(chǔ)庫(kù)中刪除此文件。為了進(jìn)一步操作,他使用gitrm命令。
[tom@CentOSsrc]$lsMakefilestring_operationsstring_operations.c[tom@CentOSsrc]$gitrmstring_operationsrm'src/string_operations'[tom@CentOSsrc]$gitcommit-a-m"Removedexecutablebinary"[master5776472]Removedexecutablebinary1fileschanged,0insertions(+),0deletions(-)deletemode100755src/string_operations提交后,他將更改推送到存儲(chǔ)庫(kù)。
[tom@CentOSsrc]$gitpushoriginmaster上面的命令將產(chǎn)生以下結(jié)果。
Countingobjects:5,done.Compressingobjects:100%(3/3),done.Writingobjects:100%(3/3),310bytes,done.Total3(delta1),reused0(delta0)Togituser@git.server.com:project.git29af9d4..5776472master?>master