我花了很长时间阅读并试图弄清楚 git commit --amend,但我仍然不明白 # 在 editmsg 中是如何使用的。
我担心在不知道自己在做什么的情况下对其进行编辑,因为我已阅读 git commit --amend 仅执行最近的提交,并且一旦我保存并退出,它将被视为新提交。
我不小心提交并推送(但推送失败)一些大文件。但我也编写了应该从与大文件相同的提交中推送的脚本。
我正在尝试删除新提交中包含大文件的行,但我不明白如何执行此操作。
这是我下面的提交文件,但我不明白是否应该删除带有 # 的行(我试过了,但没有用,git log 是一样的):
the commit message of the one I want to change is here but I don't want to just change the message, I want to delete the large files in the commit so that the push works.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Thu Feb 8 18:30:32 2018 -0900
#
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
# (use "git push" to publish your local commits)
#
# Changes to be committed:
# new file: script.py
# new file: super_large_file.npy <--- I deleted this line but it appeared again, it is becuase deleting a line with # is ignored? Do I just rewrite the stuff after the # lines?
我的问题是,为什么删除大文件的行(包括 # )不起作用并且提交仍然想要推送大文件?
我应该只重写没有 # 的提交文件吗?但我也读到 git 拿走了 # ,所以我很困惑