如何在git中推送所有提交

时间:2020-09-20 14:44:40

标签: git github

我在git中有一些提交。

我想一次提交所有它们。

我尝试了以下命令

git push origin develop

看来我只能推送最新的本地提交。

有没有办法提交所有本地提交?

$ git status

On branch event-api
Your branch is up to date with 'origin/develop'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   api/Dockerfile
        modified:   api/package-lock.json
        modified:   api/package.json
        modified:   api/src/user/user.controller.ts
        modified:   api/src/user/user.service.ts

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        api/.env

no changes added to commit (use "git add" and/or "git commit -a")

$ git log

commit e06b782c44a0c4ffb91b64d95744323e6cb5a40e (HEAD -> event-api, origin/event-api, origin/develop, foo-event-api)
Author: hikaru 
Date:   Sun Sep 20 23:57:36 2020 +0900

    Revert "user.entity.ts"
    
    This reverts commit 38e3ac8a623d70ee89c41226d796fb4753cca10b.

commit 38e3ac8a623d70ee89c41226d796fb4753cca10b
Author: hikaru 
Date:   Sun Sep 20 22:49:39 2020 +0900

    user.entity.ts

commit 11d166321a5831c01a491358d6afa1be4020bbfb
Author: hikaru 
Date:   Sun Sep 20 22:40:51 2020 +0900

    add app.module.ts

commit 38eb630546eed370619b1f5178f949df99bbda07
Author: hikaru 
Date:   Sun Sep 20 22:38:12 2020 +0900

    add event

commit 8dec7bc37c539f35aa03cf3188b7adb104e1a91f
Author: hikaru
Date:   Sun Sep 20 22:36:37 2020 +0900

    add repository

谢谢

1 个答案:

答案 0 :(得分:0)

git status命令显示您已修改了五个文件。但是您尚未创建任何提交。如果要为每个文件创建一个提交并将其推送到存储库中,则需要执行以下几行:

git add api/Dockerfile
git commit -m "your message"
git push

如果要推送所有修改的更改,可以使用以下命令:

git commit -a
git push