What is a comment in commit_editmsg in github

喜欢而已 提交于 2019-12-24 22:25:12

问题


I have spent a long time reading and trying to figure out git commit --amend, but I still do not understand how the # are used in the editmsg.

I am worried to edit this without knowing what I am doing because I have read that git commit --amend only does the most recent commit,and once I save and exit , it will be counted as a new commit.

I have accidentally committed and pushed (but the push failed) some large files. But I have also written scripts that were supposed to be pushed from the same commit as the large files.

I am trying to delete the lines with the large files in the new commit , but I don't understand how to do this.

This is my commit file below, but I don't understadn if I should delete the lines with the # (I tried this but it didn't work , and the git log is the same ):

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? 

My question is , why does deleting the line of the large file (including the # ) not work and the commit remains still wanting to push the large file?

Should I just rewrite the commit file without the # ? But I also read that git takes away the # , so I am confused


回答1:


I tried a different way than amending the commit , and removed the file completely from my local and github repositories. I am not sure how to keep it in my local repository still, but I don't know if this is necessary because I don't really understand the difference between my local repository and the local drive .

https://help.github.com/articles/removing-files-from-a-repository-s-history/

(I found this link from Bluemoon93's answer on Can't push to GitHub because of large file which I already deleted )



来源:https://stackoverflow.com/questions/48699317/what-is-a-comment-in-commit-editmsg-in-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!