選擇該選項時似乎git commit不起作用。--porcelain這是一個錯誤嗎?還是我對作業原理有誤解git commit?
我有一個包含一個已修改檔案的存盤庫。當我運行時git status,我看到了這個(如預期的那樣):
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: README.md
當我運行時,git commit -m "Update to readme" --porcelain我得到這個輸出:
$ git commit -m "Update to readme" --porcelain
M README.md
但是,當我git status再次運行時,我得到了原始輸出:
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: README.md
現在,如果我在沒有--porcelain得到預期行為的情況下提交:
[main 6f17cac] Update to readme
1 file changed, 6 insertions( ), 3 deletions(-)
并且git status還給出了預期的結果:
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
這是一個錯誤嗎?還是我對作業原理有誤解git commit?
我在 MacOS 12.6 上使用 git 2.37.1:
$ git --version
git version 2.37.1 (Apple Git-137.1)
uj5u.com熱心網友回復:
--porcelain暗示--dry-run哪個實際上并沒有進行提交。
--空運行
不要創建提交,而是顯示要提交的路徑串列、具有未提交的本地更改的路徑和未跟蹤的路徑。
- 瓷
進行試運行時,以瓷器就緒格式提供輸出。有關詳細資訊,請參閱 git-status(1)。暗示 --dry-run。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/529423.html
標籤:混帐github
