git 删除远程仓库中的文件
haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ git pull Already up to date.
或者先下载
haife@hp MINGW64 /d/download/github/haifeng2017 $ git clone https://github.com/haifeng2017/calculator.git Cloning into 'calculator'... remote: Enumerating objects: 42, done. remote: Counting objects: 100% (42/42), done. remote: Compressing objects: 100% (24/24), done. remote: Total 42 (delta 9), reused 38 (delta 8), pack-reused 0 Unpacking objects: 100% (42/42), done. |
haife@hp MINGW64 /d/download/github/haifeng2017 $ cd calculator |
haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ ls -la total 214 drwxr-xr-x 1 haife 197609 0 3月 11 12:28 ./ drwxr-xr-x 1 haife 197609 0 3月 11 12:28 ../ drwxr-xr-x 1 haife 197609 0 3月 11 12:28 .git/ drwxr-xr-x 1 haife 197609 0 3月 11 12:28 .vs/ drwxr-xr-x 1 haife 197609 0 3月 11 12:28 calculator/ -rw-r--r-- 1 haife 197609 902 3月 11 12:28 calculator.sln -rw-r--r-- 1 haife 197609 199680 3月 11 12:28 calculator.suo -rw-r--r-- 1 haife 197609 131 3月 11 12:28 README.md -rw-r--r-- 1 haife 197609 108 3月 11 12:28 readme.txt drwxr-xr-x 1 haife 197609 0 3月 11 12:28 Release/ |
我们要删除文件 calculator.suo, 文件夹 .vs/ 和 Release/
以及 calculator/calculator.vcxproj.filters 和 calculator/calculator.vcxproj.user
haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ cd calculator haife@hp MINGW64 /d/download/github/haifeng2017/calculator/calculator (master) $ ls BigNumber.cpp calculator.vcxproj ReadMe.txt stdafx.h BigNumber.h calculator.vcxproj.filters sqrt.cpp targetver.h calculator.cpp calculator.vcxproj.user stdafx.cpp Variable.h haife@hp MINGW64 /d/download/github/haifeng2017/calculator/calculator (master) $ git rm calculator.vcxproj.filters rm 'calculator/calculator.vcxproj.filters' haife@hp MINGW64 /d/download/github/haifeng2017/calculator/calculator (master) $ git rm calculator.vcxproj.user rm 'calculator/calculator.vcxproj.user' haife@hp MINGW64 /d/download/github/haifeng2017/calculator/calculator (master) $ ls BigNumber.cpp calculator.cpp ReadMe.txt stdafx.cpp targetver.h BigNumber.h calculator.vcxproj sqrt.cpp stdafx.h Variable.h |
haife@hp MINGW64 /d/download/github/haifeng2017/calculator/calculator (master) $ cd .. haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ ls calculator/ calculator.sln calculator.suo README.md readme.txt Release/ haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ git rm calculator.suo rm 'calculator.suo' |
haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ git rm -r .vs/ rm '.vs/calculator/v14/.suo' |
haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ git commit -m "delete some nonrelated files" [master a68286d] delete some nonrelated files 5 files changed, 51 deletions(-) delete mode 100644 .vs/calculator/v14/.suo delete mode 100644 calculator.suo delete mode 100644 calculator/calculator.vcxproj.filters delete mode 100644 calculator/calculator.vcxproj.user delete mode 100644 readme.txt haife@hp MINGW64 /d/download/github/haifeng2017/calculator (master) $ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 308 bytes | 154.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To https://github.com/haifeng2017/calculator.git 3487c12..a68286d master -> master |