請原諒我的無知......這裏是背景:我創建了一個TestScritps目錄來組織測試腳本。我將三個腳本從<root dir>
移到<root dir>/TestScripts
。我每次移動一個,並在每個之後執行一次本地提交。然後我推動了所有的變化。'git mv'爲什麼不移動文件?如何使其「正常」行爲?
我去到另一臺機器,並進行了拉:
$ cd cryptopp/
$ git pull
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 25 (delta 11), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (25/25), done.
From https://github.com/weidai11/cryptopp
2ac9ea1..2a22a84 master -> origin/master
Updating 2ac9ea1..2a22a84
Fast-forward
TestScripts/cryptest-android.sh | 44 +
TestScripts/cryptest-ios.sh | 40 +
TestScripts/cryptest.sh | 5729 +++++++++++++++++++++++++++++++++++++++
rijndael.cpp | 2 +-
setenv-android.sh | 85 +-
5 files changed, 5870 insertions(+), 30 deletions(-)
create mode 100755 TestScripts/cryptest-android.sh
create mode 100755 TestScripts/cryptest-ios.sh
create mode 100755 TestScripts/cryptest.sh
$ ls *.sh
cryptest-android.sh cryptest.sh setenv-android.sh setenv-ios.sh
cryptest-ios.sh rdrand-nasm.sh setenv-embedded.sh
通知文件只複製;他們沒有被移動。
我檢查了git-mv
man page,但錯誤的行爲似乎沒有討論。
我有兩個問題。爲什麼git mv
只複製文件,而不是移動它們?如何讓git mv
「正常」執行?在這裏,「通常」意味着幾乎每個使用命令行的人都期望 - 它將文件從<target location>
移動到<destination location>
。
這裏是相關的命令歷史。
994 rm -rf cryptopp/
995 git clone https://github.com/weidai11/cryptopp
996 cd cryptopp/
997 mkdir TestScripts
998 git mv cryptest.sh TestScripts/
999 ls *.sh
1000 git commit TestScripts/cryptest.sh -m "Organize test scripts (Issue 303)"
1001 ls *.sh
1002 git mv cryptest-ios.sh TestScripts/
1003 git commit TestScripts/cryptest-ios.sh -m "Organize test scripts (Issue 303)"
1004 ls *.sh
1005 git commit
你從'git status'得到了什麼? – Amit
在原始機器上執行的命令的確切順序是什麼? –
@Amit - 在執行移動的機器上:***'您的分支與'origin/master'是最新的。「***但是,我刪除了克隆並重新克隆。我發現它有時要求Git不要破壞它的索引文件。當發生這種情況時,我甚至無法切換分支機構,因此我們不惜一切代價盡力避免這種情況。副本和動作似乎經常會打破Git,所以我在手術後就這樣做了。 – jww