关于GIT的commit操作问题
天蓬老师
天蓬老师 2017-05-02 09:34:50
0
3
642

当磁盘(本地文件)和缓存区都有修改时,如下图:


使用:git commit -m 'xxx' 会提交缓存区的修改,本地修改不会提交。
而当使用 git commit -m 'xxxx' a.php 时 ,缓存区和本地修改都提交上去了。
这是正确的git原理吗?求大神解释。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
習慣沉默

You can’t submit it like this! After executiongit commit -m '提交日志',肯定要执行一下git push origin 分支才能更新到对应的远程分支。git commit -m '提交日志'It is useless to add modified files afterwards

世界只因有你

That's right, git commit -m 'xxx' will only submit updates to files that have been added by git to the staging area, and in batches, that is, all files in the staging area will be submitted

git commit -m 'xxx' a.php, the specified file can be submitted without git add, but only one. If you want multiple files, you must append the complete file names one by one after the command

So if I want to commit all the modified files, but there is no git add to the staging area, I will use this command git commit -am 'x'

左手右手慢动作

When files are given on the command line, the command commits the contents of the named files, without recording the changes already staged. The contents of these files are also staged for the next commit on top of what have been staged before.

Your understanding is correct. Finally, carrying the file parameters will directly commit the current contents of these files instead of the changes in the buffer.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!