I am running into this problem on a rails app I am working on. I was working on a feature branch and wanted to rebase from the most recent master. I ran the following commands:
$ git checkout master
$ git pull --rebase
If I try to checkout back to my feature branch I get the following error:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
I have tried the following commands to resolve the Gemfile.lock back to aster with none of them being successful:
$ git checkout -- Gemfile.lock
$ git stash
$ git reset HEAD --hard
Every time I run a new git command I go back to the Gemfile.lock having changes not staged for commit.
Here are the following versions of libraries I am working with:
$ git --version => 2.3.3
$ bundler --version => 1.7.9
The Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions.
There is now one additional commit in our repository which contains the change we made to README.md. The “changes not staged for commit” message shows when you run the “git status” command and have a file that has been changed but has not yet been added to the staging area.
When performing an operation including moving folders, files and even deleting several folders and files, there are operations which is actually doesn’t included into the staging area in the git commit execution as shown below : Below is the execution of the command : After committing the already changed files, push it to the Repository Git :
This means the staging area is somewhat of a triage space. If you realize an additional file needs to be added into a commit, you can add it to staging. Then, once you are sure you have added all the changes to the staging area, you can create a commit. To receive this message, we must first change a file in a Git repository.
There must be some process running in the background or some side-effect of executing the git commands in your shell that is modifying the Gemfile.lock.
I am not familiar with rvm's magic (although that sounds plausible); here are some other things to check:
spring stop
(or bin/spring stop
or bundle exec spring stop
) to gracefully terminate that process..git/hooks
directory.git
might be an alias in your shell for another command. Run alias
to see a list of shell aliases..bashrc
or .bash_profile
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With