【问题标题】:Gitcola says "you must stage at least 1 file before you can commit"Gitcola 说“您必须先暂存 1 个文件,然后才能提交”
【发布时间】:2018-02-20 01:54:29
【问题描述】:

虽然我已经对我克隆的存储库的文件夹进行了更改,但我无法提交..

【问题讨论】:

  • 听起来您还没有进行更改。在 Git 中,您首先暂存更改,然后提交已暂存的更改。许多 Git 工具让您只需提交所有更改而无需先进行暂存,但它们只是在幕后为您暂存。听起来 Gitcola 不这样做。
  • 您是否对更改的文件执行了“git add”?
  • 是时候阅读至少一篇(非常)简短的关于 git 的教程了...

标签: git commit git-commit git-clone


【解决方案1】:

提交的基础知识:

git status - 显示 repo 的状态,包括未暂存的文件。

git add <filename> 暂存该文件。

git add --all 暂存所有文件。

git commit 开始提交。

git commit -m "message" 是单行提交

git commit -a 提交所有文件

git push <remote> <branch> 将分支及其提交推送到远程 refspec,例如git push origin master

【讨论】:

    【解决方案2】:

    它是否说“没有更改添加到提交”?

    如果是这种情况,您必须先手动添加要提交的文件。使用:

    git add <filename>
    

    filename 是您进行更改的文件。例如:

    git add aFolder/source/file.txt
    

    然后你就可以提交了。

    【讨论】:

      猜你喜欢
      • 2021-03-15
      • 2019-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多