Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

.gitignore and the following untracked working tree files would be overwritten by checkout

Asked by Aaditya Srivastva Apr 27, 2021 1.1K views 1 answer
Share

About this question

So I added a folder to my .gitignore file.

Once I do a git status it tells me

# On branch latest
nothing to commit (working directory clean)

However, when I try to change branches I get the following:

My-MacBook-Pro:webapp marcamillion$ git checkout develop
error: The following untracked working tree files would be overwritten by checkout:
.......
Please move or remove them before you can switch branches.
Aborting

This is what my .gitignore file looks like:

.bundle
.DS_Store
db/*.sqlite3
log/*.log
tmp/**/*
public/system/images/*
public/system/avatars/*

How do I get this working so I can switch branches without deleting those files?

If I make a change, will it affect those files? In other words, if I came back to this branch afterward would everything be perfect as up to my latest commit?

I don't want to lose those files, I just don't want them tracked.

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.