git 如何提交和推送所有更改,包括删除?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9329244/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:00:15  来源:igfitidea点击:

How to commit and push all changes, including deletes?

git

提问by missingfaktor

How to commit and push all changes, including additions, editions, and file deletions etc in one command?

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

回答by Andy

You will have to do git add -Ato add all files new files, changes and removed files. Than follow that up with git commitand git push

您将不得不git add -A添加新文件、更改和删除文件的所有文件。比跟进git commitgit push

回答by Gaurav Rathi

please follow these command git commit -am "message" (to add and commit in single command) git push origin [branch Name]

请遵循这些命令 git commit -am "message"(在单个命令中添加和提交) git push origin [branch Name]

回答by aki_sud

Use the following commands-

使用以下命令-

  1. git add -Ato add all files new files, changes and removed files.
  2. git commit -m "Your message"to save the changes done in the files.
  3. git push -u origin masterto send your committed changes to a remote repository, where the local branch is named master to the remote named origin
  1. git add -A添加所有文件 新文件、更改和删除的文件。
  2. git commit -m "Your message"保存在文件中所做的更改。
  3. git push -u origin master将您提交的更改发送到远程存储库,其中本地分支名为 master 到远程命名源

回答by Sandeep Nair

Can you please try the following git commit -a

你能试试下面的吗 git commit -a

回答by Lazy Badger

Combineall needed separate commands in one alias?!

所有需要的单独命令组合在一个别名中?!

回答by mironq

As I understand your question you are asking about "-u" option used as below which will add all already existing in repo entries (but no new ones):

据我了解您的问题,您正在询问以下使用的“-u”选项,该选项将添加所有已存在于 repo 条目中(但没有新条目):

git add -u

which accordingly to man pages:

根据手册页:

   -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).
   -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).