git - 什么是 git status 替代品!svn状态结果
问题描述
我正在修改一个脚本,它检查 svn 状态以获取以下结果代码:!
在文档中我可以看到!对应于以下描述:
项目丢失(例如,您在没有使用 svn 的情况下移动或删除了它)。这也表明目录不完整(签出或更新被中断)。
SVN 结果示例:
svn status
! trunk/script/test.txt
有人可以告诉 git 结果替代品是什么!。我检查了 git 文档,但我不确定是否 svn !对应于 D。
感谢您的帮助!
解决方案
SVN 和 Git 在这方面的工作方式略有不同。粗略的 Git 等效项已从工作目录中删除,但未暂存。
$ rm this
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: this
no changes added to commit (use "git add" and/or "git commit -a")
你可以得到一个简短的版本,git status -s
在这种情况下,它是第二列中的 D。
$ git status -s
D this
Git 有一个“暂存区”,可以将其视为构建新提交的地方。您对工作目录(即磁盘上的文件)进行更改,然后使用git add
and将它们“暂存” git rm
。然后git commit
提交暂存的内容。
Git 可以在 Git 之外添加、删除和更改文件。除非明确分阶段,否则它不会提交它们。
$ git rm this
rm 'this'
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: this
简短版本是第一列中的 D。
$ git status -s
D this
查看git status
更多。
相比之下,SVN 没有暂存区;磁盘上更改的内容就是提交的内容。这样不告诉SVN就删除跟踪文件是不正常的;您可能不是有意删除该文件。SVN 提交比 Git 更难修改和撤消。
推荐阅读
- c# - 为什么调用 Semaphore.WaitOne 会出现死锁?
- javascript - ReactJS POSTrequest 不起作用(404)但 GETrequest 有效
- typescript - 对一串数字范围进行 Mat-sort
- python - 使用列表和字典创建数据框
- wpf - 已解决 - 使用预定义列设置 DataGridColumnHeader 模板会添加太多列
- php - 从两个键数组中查找重复项并对不同的键求和
- java - Java 总是按值传递,为什么我在使用 Array.get(index) 时会得到引用?
- sql - 带有ID的表连接的SQL查询不匹配
- powershell - 如何使用 Powershell 打开二进制管道
- c# - Docker Copy 使用 ASP.net Core 失败