Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout error with working tree clean

Tags:

git

Please, I get the error "Your local changes to the following files would be overwritten by checkout" but my working tree is clean.

does anyone have any idea of what is going on here?

$ git status
On branch experiment
nothing to commit, working tree clean

$ git checkout develop
error: Your local changes to the following files would be overwritten by checkout:
app/build.gradle
Please commit your changes or stash them before you switch branches.
Aborting

(the file app/build.gradle is not in my .gitignore file)


This is the top level .gitignore file:

### Android ###

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
.idea
*.iml

# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and     later
.externalNativeBuild

# Mac
.DS_Store

### Android Patch ###
gen-external-apklibs

This is a .gitignore file inside the /app directory (I don't know why it is there):

build

# Secrets
secrets.properties
like image 684
Lisa Anne Avatar asked Jun 02 '26 20:06

Lisa Anne


1 Answers

A wild shot :

I once read about a hidden "assume unchanged flag" (see this answer for example),
and the only way I know of for seeing if this flag is active on a file is (see this answer) :

git ls-files -v | grep '^[[:lower:]]'

What do you see when you run the above command on your repo ?

like image 185
LeGEC Avatar answered Jun 05 '26 09:06

LeGEC