使當前提交成爲Git存儲庫中惟一的(初始)提交? - Make the current commit the only (initial) commit in a Git repository?

問題:

I currently have a local Git repository, which I push to a Github repository. 我目前有一個本地Git存儲庫,我將其推送到Github存儲庫。 app

The local repository has ~10 commits, and the Github repository is a synchronised duplicate of this. 本地存儲庫有大約10個提交,而Github存儲庫是其同步副本。 ui

What I'd like to do is remove ALL the version history from the local Git repository, so the current contents of the repository appear as the only commit (and therefore older versions of files within the repository are not stored). 我想作的是從本地Git存儲庫中刪除全部版本歷史記錄,所以存儲庫中的當前內容顯示爲惟一的提交(所以不會存儲存儲庫中較舊版本的文件)。 this

I'd then like to push these changes to Github. 而後,我想將這些更改推送到Github。 spa

I have investigated Git rebase, but this appears to be more suited to removing specific versions. 我已經研究了Git變基,可是這彷佛更適合刪除特定版本。 Another potential solution is to delete the local repo, and create a new one - though this would probably create a lot of work! 另外一個可能的解決方案是刪除本地存儲庫,而後建立一個新的存儲庫-儘管這可能會致使不少工做! .net

ETA: There are specific directories / files that are untracked - if possible I would like to maintain the untracking of these files. 預計到達時間:有些特定的目錄/文件沒法跟蹤-若是可能的話,我想保持對這些文件的跟蹤。 ci


解決方案:

參考一: https://stackoom.com/question/ed3v/使當前提交成爲Git存儲庫中惟一的-初始-提交
參考二: https://oldbug.net/q/ed3v/Make-the-current-commit-the-only-initial-commit-in-a-Git-repository
相關文章
相關標籤/搜索