【问题标题】:How to commit and push all changes, including deletes?如何提交和推送所有更改,包括删除?
【发布时间】:2012-02-17 13:38:29
【问题描述】:

如何在一个命令中提交和推送所有更改,包括添加、编辑和文件删除等?

【问题讨论】:

    标签: git


    【解决方案1】:

    您必须执行git add -A 来添加所有文件新文件、更改和删除文件。然后用git commitgit push 跟进

    【讨论】:

      【解决方案2】:

      使用以下命令-

      1. git add -A 添加所有文件新文件、更改和删除文件。
      2. git commit -m "Your message" 保存在文件中所做的更改。
      3. git push -u origin master 将您提交的更改发送到远程 存储库,其中本地分支被命名为 master 到远程 命名来源

      【讨论】:

        【解决方案3】:

        请按照这些命令 git commit -am "message"(在单个命令中添加和提交) git push origin [分支名称]

        【讨论】:

        • commit -a 更新现有文件,但不添加新文件。请参阅git help commit 或尝试一下。
        【解决方案4】:

        Combine 一个alias?!

        【讨论】:

          【解决方案5】:

          请您尝试以下方法 git commit -a

          【讨论】:

          • 如果有新文件尚未添加到存储库中,您仍然需要git add它们。
          【解决方案6】:

          据我了解您的问题是关于“-u”选项的使用,如下所示,它将添加所有已经存在的 repo 条目(但没有新条目):

          git add -u
          

          根据手册页:

             -u, --update
                 Update the index just where it already has an entry matching <pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files.
                 If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).
          

          【讨论】:

            猜你喜欢
            • 2017-11-25
            • 1970-01-01
            • 1970-01-01
            • 2013-12-15
            • 2019-07-01
            • 2018-07-20
            • 2013-02-13
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多