Github 解决错误:";在切换分支之前提交或隐藏更改";?

Github 解决错误:";在切换分支之前提交或隐藏更改";?,github,git-stash,Github,Git Stash,我在主分支机构上,该分支机构的暂存区中有以下文件: modified: app/assets/stylesheets/login.css modified: app/controllers/application_controller.rb modified: app/controllers/users_controller.rb modified: app/views/users/forgot.html.erb modified: app/v

我在主分支机构上,该分支机构的暂存区中有以下文件:

modified:   app/assets/stylesheets/login.css
    modified:   app/controllers/application_controller.rb
    modified:   app/controllers/users_controller.rb
    modified:   app/views/users/forgot.html.erb
    modified:   app/views/users/new.html.erb
    new file:   app/views/users/new_password.html.erb
    modified:   config/routes.rb
由于我希望获取最新的提交,我使用

“吉特藏匿处”

,做了一个

“git pull”

。然后我转到我的本地分支机构“密码更改”
,并做了一个测试

“吉特隐藏流行音乐”

现在我在我当地的分公司有上述文件。 当我尝试返回master branch时,它给出了以下错误:

error: Your local changes to the following files would be overwritten by checkout:
    app/controllers/application_controller.rb
Please, commit your changes or stash them before you can switch branches.
流产


我希望仅将这些文件保存在我的本地分支机构中,即“密码更改”并移至主分支机构。我应该如何克服这个错误?请帮助我,因为我是github的新手。

好吧,按照错误消息所述提交它们。可能是您将应用程序\u controller.rb添加到gitignore本地。您可以尝试
git更新索引--no假设app/controllers/application\u controller.rb未更改,然后再次尝试提交它。