我如何使用git提交文件? [英] How can I commit files with git?
问题描述
这些教程都不会有帮助!
他们都会这样做,他们只是假设我知道该怎么做。
None of the tutorials will help!
They all do that thing where they just assume I know what to do..
目前,我的终端窗口以..开始。
Currently, my terminal window starts with..
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: httpdocs/newsite/manifest/cache/0a432970ba6491fe65dad60b012e5c95_louloumay2011en-1-4dea3186b7f7b.jpg
# deleted: httpdocs/newsite/manifest/cache/0a61b5d7a9e97da78fe602e1ad41edb6_5-4dec7c3d57c80.jpg
# deleted: httpdocs/newsite/manifest/cache/0afb6a7716a85d0de46cdd03bb30f75f_fifa_panorama_full_page-01_thu-4dea3d1a0e0f5.jpg
# deleted: httpdocs/newsite/manifest/cache/0b3bc9be76a5d3e1e36af4b8dcf98658_free2-4df0e2e08761f.jpg
# deleted: httpdocs/newsite/manifest/cache/0b6342913b8e599fac76da452af98ec5_si-feb-2009-1-4dea3d1abcb61.jpg
# deleted: httpdocs/newsite/manifest/cache/0b9ddc587340f7744e03c4b2dafacf7f_lou-lou-winter-2009-cover-4dea3d1a9b1a0.jpg
# deleted: httpdocs/newsite/manifest/cache/0bf64ff8fc22720b3da20d0730fa6a04_chatelaine-dec-2009-4dea3d18daa30.jpg
# deleted: httpdocs/newsite/manifest/cache/0bf664e03eb0a2255b69b02aed85add0_summumfeb2011-2-4dea3188766aa.jpg
但没有方法知道如何做他们说的在这里做..
http://learn.github .com / p / normal.html
but there's no way to know how to do what they say to do here..
http://learn.github.com/p/normal.html
所有内容都是
All it says is
这是什么意思?!
我们只需输入我们的提交信息并退出编辑器。仅仅因为你写了这个词并不意味着它很简单。
What does that mean?!
Just because you write the word simply doesn't mean it is simple..
当我开始输入时,它确实很奇怪,录音或插入,并有大约300个文件,它希望我用一条消息来替换每一行?!?
When I start to type it does wierd stuff, says "recording" or "inserting" and there are about 300 files, and it wants me to replace every line with a message?!?
我会用它的方便的Mac应用程序来做这件事,但是如果它超过20个文件左右,它会冻结!
这是怎么回事?
I would use their handy Mac application for this, but if it's over 20 files or so, it freezes up !
What's up with that??
推荐答案
当你运行没有参数的 git commit
时,它会打开你的默认编辑器,允许你输入一个提交信息。保存文件并退出编辑器将进行提交。
When you run git commit
with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit.
它看起来像您的默认编辑器是Vi或Vim。输入时发生奇怪的东西的原因是Vi没有以插入模式启动 - 您必须先敲击键盘上的 i !如果你不想这样做,你可以把它改成更简单的方式,例如:
It looks like your default editor is Vi or Vim. The reason "weird stuff" happens when you type is that Vi doesn't start in insert mode - you have to hit i on your keyboard first! If you don't want that, you can change it to something simpler, for example:
git config --global core.editor nano
然后,您会在提交时加载Nano编辑器(假设它已安装!)对于没有使用Vi等模态编辑器的用户而言,它更直观。
Then you'll load the Nano editor (assuming it's installed!) when you commit, which is much more intuitive for users who've not used a modal editor such as Vi.
您在屏幕上看到的文字只是为了提醒您承诺。行之前是#
,这意味着它们是注释,即Git在保存提交消息时会忽略这些行。您无需为每个文件键入一条消息,只需在编辑器缓冲区的顶部输入一些文本。
That text you see on your screen is just to remind you what you're about to commit. The lines are preceded by #
which means they're comments, i.e. Git ignores those lines when you save your commit message. You don't need to type a message per file - just enter some text at the top of the editor's buffer.
要绕过编辑器,您可以提供一条提交消息作为参数,例如
To bypass the editor, you can provide a commit message as an argument, e.g.
git commit -m "Added foo to the bar"
这篇关于我如何使用git提交文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!