简体   繁体   中英

Unable to discard changes in working directory

I have this file in working directory called Gemfile.lock. Basically, this file gets refreshed every time another file Gemfile gets modified. But I was able to

git stash

Gemfile but Gemfile.lock did not get put in stash. So then I tried

git checkout Gemfile.lock 

and

git checkout -- Gemfile.lock

But everytime I run 'git status', it remains highlighted in red in the working directory. I do not want to add it to the staging area to be committed to my local repository and ultimately the remote repository. But I also want to

git checkout 

to another branch. But this file being in the working directory is preventing me from switching branches. What can I do?

Keep in mind, I do not want to add this file to .gitignore and invoke ' git rm --cached <file-name> ', because I do want this file to be tracked in git. I just do not want my current revision to be tracked.

I had a case where spring caused troubles. Never figured out what happened. Should you use rails with spring , then try spring stop first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM