如何在一个命令中提交和推送所有更改,包括添加、版本和文件删除等?
您必须执行git add -A
才能添加所有文件新文件、更改和删除的文件。然后用git commit
和git push
使用以下命令-
git add -A
添加所有文件新文件、更改和删除的文件git commit -m "Your message"
以保存在文件中所做的更改git push -u origin master
将您提交的更改发送到远程存储库,其中本地分支被命名为远程的master命名原点
请执行以下命令git commit-am"message"(在单个命令中添加和提交)git push origin[分支名称]
将所有需要的单独命令合并到一个别名中?!
你能试试下面的吗git commit -a
据我所知,您所问的问题是关于以下使用的"-u"选项,该选项将添加所有已存在的回购条目(但没有新条目):
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).