简体   繁体   English

Git命令行的语法含义是什么?

[英]Git command line syntax meaning?

I've created a .gitignore file but I'm not sure if it is working or not. 我创建了一个.gitignore文件,但不确定该文件是否有效。

Currently i have this in the gitignore file in the DEMOPROJECT directory 目前我在DEMOPROJECT目录的gitignore文件中有这个

*db.*
__init__.py 

And I'm getting this output in the windows command line 我在Windows命令行中得到此输出

(venv) C:\..\..\PycharmProjects\WebP1\DEMOPROJECT>git checkout newMast
Switched to branch 'newMast'
D       .gitignore
M       db.sqlite3

What is the significance of the D and M ? DM的意义是什么?

D代表删除,M代表修改您需要将.gitignore提交到您的分支。

That is the result of the short version of git status . 这是git status的简短版本的结果。

Based on https://git-scm.com/docs/git-status , 基于https://git-scm.com/docs/git-status

  • ' ' = unmodified ''=未修改
  • M = modified M =修改
  • A = added A =已添加
  • D = deleted D =已删除
  • R = renamed R =重命名
  • C = copied C =复制
  • U = updated but unmerged U =更新但未合并

You can learn more abot the meaning of each stage at https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository . 您可以通过https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository进一步了解每个阶段的含义。

Edit: I think for your case it seems that the db.sqlite3 has been tracked beforehand, so even though you have added it in .gitignore , the changes would still be tracked. 编辑:我认为对于您的情况,似乎已经预先跟踪了db.sqlite3 ,因此,即使您已将其添加到.gitignore ,更改仍将被跟踪。 You can see how to fix it at How to make Git "forget" about a file that was tracked but is now in .gitignore? 您可以在如何让Git“忘记”已跟踪但现在位于.gitignore的文件中看到如何修复它 .
Also, it seems that the .gitignore file is somehow deleted before you perform the checkout? 另外,似乎在执行结帐之前以某种方式删除了.gitignore文件?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM