所以,我一整天都在努力让我的暂存分支正常工作,但我遗漏了一些东西。
这是事件链:
git branch
develop
*master
staging
做一些改变
git checkout staging
M app/views/comments/index.html.erb
M app/views/devise/registrations/new.html.erb
M app/views/devise/sessions/new.html.erb
M app/views/layouts/application.html.erb
M app/views/songs/contact.html.erb
M app/views/songs/faq.html.erb
M app/views/songs/index.html.erb
M app/views/songs/new.html.erb
M app/views/songs/new_songs.html.erb
Switched to branch 'staging'
git gui (git commit and then git push staging)
git checkout master
git push staging master (deployment)
Everything up-to-date
一切都不是最新的,我只是做了 10 处更改,我希望在我的暂存服务器上看到这些更改。
我怎样才能让它工作?
最佳答案
您的工作流程中缺少一个关键步骤:在提交之前添加更改。
使用前git commit
, 运行 git add -A
将工作目录中的所有文件添加到你的 git 仓库中。或者,您可以使用 git add <path-to-file>
添加特定文件,或使用 git commit -a
将所有修改添加到您的 git 仓库。但是请注意 git commit -a
不会添加新文件,它只会添加您对现有文件所做的更改。
如果您想查看自己所在的位置,请输入 git status
.红色文件已更改,未暂存(“暂存”更改等同于“添加”它),而绿色文件已添加。如果git status
说“工作目录干净”,那么自上次提交以来您还没有进行任何更改。
关于git - 一切都是最新的(一切都不是),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18280962/