我有以下用例:
在我的本地計算機上,我在任何版本控制系統(包括 git)之外都有以下檔案/檔案夾結構。
ProjectFolder
---Folder1
----File1.txt
----Folder2
----File2.txt
----100s of other files/folders
為了準備版本控制,我首先git init在這個檔案夾中運行。
這給了我:
ProjectFolder
---.git
---Folder1
----File1.txt
----Folder2
----File2.txt
----100s of other files/folders
然后我去了 github 并創建了一個存盤庫,說:
https://github.com/Tryer/ProjectFolder.git
在此之后,從我機器上的命令列,我發出:
git remote add origin https://github.com/Tryer/ProjectFolder.git
我不想將Folder2其內容添加到提交中。我只想要Folder1提交它的內容。
我錯誤地沒有創建正確的.gitignore檔案,導致從Folder2我發布時開始暫存一些檔案git add .
I do not now remember exactly whether I issued git rm -f <files from Folder2> or git rm --cached <files from Folder2> to unstage the unneeded files from Folder2. The former would have forced deleted the files from Folder2 from both the staging area as well as my working tree (something I did not intend/want). The latter would have only unstaged the files but left them in my working tree (something that is precisely what I would have wanted.)
The number of files under Folder2 are rather large and a due diligence check on Folder2's contents manually on my machine seems to reveal nothing amiss in terms of missing files from my working tree.
然而,為了絕對確定,有沒有辦法列出從一開始就在存盤庫下發出的所有 git 命令?請注意,我不是在詢問我從終端命令列發出的命令的歷史記錄。這將在 powershell 歷史或 bash shell 歷史中可用。
此處提供了有關此問題的先前問題。但是,這個問題大約有 10 年的歷史,那里投票率最高的答案建議使用git reflog. 然而,這似乎在提交方面給出了歷史。我正在尋找更多我已執行的確切 git 命令。
uj5u.com熱心網友回復:
不,使用 Git 是不可能的。Git 不會跟蹤存盤庫中執行的命令。
你最好的選擇是你的 shell 的命令歷史。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/451135.html
標籤:混帐
