- 前言
- Githug 安装和使用方法
- 关卡列表
- 第 1 关 init
- 第 2 关 config
- 第 3 关 add
- 第 4 关 commit
- 第 5 关 clone
- 第 6 关 clone_to_folder
- 第 7 关 ignore
- 第 8 关 include
- 第 9 关 status
- 第 10 关 number_of_files_committed
- 第 11 关 rm
- 第 12 关 rm_cached
- 第 13 关 stash
- 第 14 关 rename
- 第 15 关 restructure
- 第 16 关 log
- 第 17 关 tag
- 第 18 关 push_tags
- 第 19 关 commit_amend
- 第 20 关 commit_in_future
- 第 21 关 reset
- 第 22 关 reset_soft
- 第 23 关 checkout_file
- 第 24 关 remote
- 第 25 关 remote_url
- 第 26 关 pull
- 第 27 关 remote_add
- 第 28 关 push
- 第 29 关 diff
- 第 30 关 blame
- 第 31 关 branch
- 第 32 关 checkout
- 第 33 关 checkout_tag
- 第 34 关 checkout_tag_over_branch
- 第 35 关 branch_at
- 第 36 关 delete_branch
- 第 37 关 push_branch
- 第 38 关 merge
- 第 39 关 fetch
- 第 40 关 rebase
- 第 41 关 repack
- 第 42 关 cherry-pick
- 第 43 关 grep
- 第 44 关 rename_commit
- 第 45 关 squash
- 第 46 关 merge_squash
- 第 47 关 reorder
- 第 48 关 bisect
- 第 49 关 stage_lines
- 第 50 关 find_old_branch
- 第 51 关 revert
- 第 52 关 restore
- 第 53 关 conflict
- 第 54 关 submodule
- 第 55 关 contribute
- 附录 A Git 学习资源
- 附录 B Linux 常用命令
- 附录 C Vim 常用命令
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
第 19 关 commit_amend
The 'README' file has been committed, but it looks like the file 'forgotten_file.rb' was missing from the commit. Add the file and amend your previous commit to include it.
已经提交了文件 'README',但忘记提交文件 'forgotten_file.rb' 了。修改前一次提交,把这个文件加进去。
文件没提交全是很常见的小失误,解决办法就是先用 git add
把忘记提交的文件添加到暂存区,再用 git commit
命令加 --amend
参数把文件追加到最近一次提交中去,语法如下:
$ git commit --amend
$ git commit --amend -m "new message"
$ git commit --amend -C HEAD
第 1 条命令会弹出一个编辑器,供你编辑提交说明;第 2 条命令会用 "new message" 代替原有的提交说明;第 3 条命令会直接使用原有的提交说明,其中 -C
表示使用已提交过的说明, HEAD
表示最近一次提交,加在一起就是使用最近一次的提交说明。
第 19 关过关画面如下:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论