簡體   English   中英

git checkout表示文件未提交,但確實是?

[英]git checkout says files aren't committed, but they are?

(project_venv) jojo@jojo-System-Product-Name:~/project_fresh/examples/relational_preloadstack1/relational_stack1-layernormordertest-pkl$ git commit -m 'Huh'
On branch refactoringNormalizerIntoPreprocessingFnx
Changes not staged for commit:
        modified:   ../current_preload_relationalstack1_to_relationalstackn/preload_stack2_relational.py
        modified:   ../current_preload_relationalstack1_to_relationalstackn/resume_training_with_new_env.py
        modified:   ../current_preload_relationalstack1_to_relationalstackn/trace.html
        modified:   ../timing_test.py
        modified:   ../../../project/torch/core.py
        modified:   ../../../project/torch/sac/twin_sac.py
        modified:   ../../../scripts/convert_gpu_model_to_gpu.py
        modified:   ../../../scripts/download_s3.py
        modified:   ../../../scripts/inspect_hd5.ipynb
        modified:   ../../../scripts/sim_goal_conditioned_policy.py

no changes added to commit
(project_venv) jojo@jojo-System-Product-Name:~/project_fresh/examples/relational_preloadstack1/relational_stack1-layernormordertest-pkl$ git checkout master
error: Your local changes to the following files would be overwritten by checkout:
        examples/relational_preloadstack1/current_preload_relationalstack1_to_relationalstackn/preload_stack2_relational.py
        examples/relational_preloadstack1/current_preload_relationalstack1_to_relationalstackn/resume_training_with_new_env.py
        examples/relational_preloadstack1/current_preload_relationalstack1_to_relationalstackn/trace.html
        examples/relational_preloadstack1/timing_test.py
        project/torch/core.py
        project/torch/sac/twin_sac.py
        scripts/convert_gpu_model_to_gpu.py
        scripts/download_s3.py
        scripts/inspect_hd5.ipynb
        scripts/sim_goal_conditioned_policy.py
Please commit your changes or stash them before you switch branches.
Aborting

為什么嘗試檢出master分支在這里給出“請提交更改...”錯誤? 您可以從上一個命令中看到我已經添加了所有更改並將它們提交給'refactoringNormalizerIntoPreprocessingFnx'分支

您正在試圖提交瞞着混帳哪些文件要用於提交更改。

在創建提交(使用git commit -m "Huh" )之前,您需要git add要包含的相關文件。

例如,要將單個文件添加到更改中,可以執行以下操作:

git add ../current_preload_relationalstack1_to_relationalstackn/preload_stack2_relational.py

如果只想添加所有已更改的文件 ,則可以執行此操作(從項目的根文件夾):

git add .

請注意,這還將向您的提交中添加“未跟蹤”文件-這表示過去不受git控制的文件。

添加文件后,您可以再次運行git status ,並且會看到“已暫存以提交”的文件列表。 一旦有了這個,您可以添加您的提交:

git commit -m "Huh"

現在,當您執行git status ,應該會看到“什么都沒提交”的消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM