如何從git儲存庫中刪除原點 - How to remove origin from git repository
問題:
Basic question: How do I disassociate a git repo from the origin from which it was cloned?基本問題:如何將 git 儲存庫與克隆它的來源解除關聯?
git branch -a
shows: git branch -a
顯示:
* master
remotes/origin/HEAD -> origin/master
and I want to remove all knowledge of origin, and the associated revisions.我想刪除所有的起源知識,以及相關的修訂。
Longer question: I want to take an existing subversion repo and make a number of smaller git repos from it.更長的問題:我想使用現有的 subversion 儲存庫並從中製作一些較小的 git 儲存庫。 Each of the new git repos should have the full history of just the relevant branch.每個新的 git 儲存庫都應該具有相關分支的完整歷史記錄。 I can prune the repo to just the wanted subtree using:我可以使用以下方法將 repo 修剪為想要的子樹:
git filter-branch --subdirectory-filter path/to/subtree HEAD
but the resulting repo still contains all the revisions of the now-discarded subtrees under the origin/master branch.但是生成的 repo 仍然包含 origin/master 分支下現在丟棄的子樹的所有修訂。
I realise that I could use the -T flag to git-svn to clone the relevant subtree of the subversion repo in the first place.我意識到我可以首先使用 git-svn 的 -T 標誌來克隆 subversion repo 的相關子樹。 I'm not sure if that would be more efficient than later running multiple instantiations of git filter-branch --subdirectory-filter
on copies of the git repo but, in any case, I would still like to break the link with the origin.我不確定這是否比稍後在 git repo 的副本上執行git filter-branch --subdirectory-filter
多個例項更有效,但無論如何,我仍然想斷開與原點的連結。
解決方案:
參考一: https://stackoom.com/question/chmM參考二: How to remove origin from git repository
- Java - 無法訪問 Foo 型別的封閉例項 - Java - No enclosing instance of type Foo is accessible
- C 中可變數量的引數? - Variable number of arguments in C ?
- 如何從 SHOW PROCESSLIST 檢視完整查詢 - How to see full query from SHOW PROCESSLIST
- 如何在 Mac 上的 IntelliJ IDEA 中增加 IDE 記憶體限制? - How to increase IDE memory limit in IntelliJ IDEA on Mac?
- 如何從git儲存庫中刪除原點 - How to remove origin from git repository
- 使用“==”與“strcmp()”的字串比較 - String comparison using '==' vs. 'strcmp()'
- 如何在 GitHub 上搜索提交訊息? - How can I search for a commit message on GitHub?
- 如何在matplotlib中的給定圖上繪製垂直線 - How to draw vertical lines on a given plot in matplotlib
- 如何獲取陣列中的最後一個鍵? - How to get last key in an array?
- 找到兩個字串之間的相似度度量 - Find the similarity metric between two strings
- 反轉 ArrayList 的最簡單方法是什麼? - What is the Simplest Way to Reverse an ArrayList?
- 從終端執行React Native App時出錯(iOS) - Error Running React Native App From Terminal (iOS)
- 如何替換一個字串的多個子字串? - How to replace multiple substrings of a string?
- 在 JavaScript 中宣告多個變數 - Declaring multiple variables in JavaScript
- C 中的回撥函式 - Callback functions in C
- 使用“for”迴圈迭代目錄中的所有檔案 - Iterate all files in a directory using a 'for' loop
- 居中/設定地圖縮放以覆蓋所有可見標記? - Center/Set Zoom of Map to cover all visible Markers?
- 管理 Docker 共享卷許可權的(最佳)方法是什麼? - What is the (best) way to manage permissions for Docker shared volumes?
- 什麼時候使用PHP常量“ PHP_EOL”? - When do I use the PHP constant “PHP_EOL”?
- 從遞迴到迭代的方法 - Way to go from recursion to iteration