I guess I am looking for something impossible to achieve but I d like to try anyway. I ve read many posts and docs about keeping local changes on git but my current workflow is still bad.
The problem:
I checkout a project. That project has a folder (a module). I then update that module. This folder looks now completely changed to Git eyes. I don't want to commit those changes. Ever. I just want to have my module updated on my local copy.
So far so good but git will always display the entire list of changes that I ve made on that folder cause it thinks I want to commit them. This means I also have to stash them everytime and I cannot do some nice stuff like git add -u
because it will commit also this folder. In short, I d like to keep my working copy clean as it should be, just ignoring what I want to ignore.
The first approach: git ignore
and git exclude
don't work with tracked files.
The second approach: git update-index --assume-unchanged
looks promising. But when I merge the folder from another branch this nice assumption is gone and my module updates will be overwritten by the merge. Looking the problem to the other side I eventually still have to stash them anyway which brings back to the original problem.
Other approaches: I thought as well to git rm --chached
. And then .gitignore
the folder. This is still not nice because git will keep this command on stage forever and I will need to keep stashing things.
I don't know if I am missing something or asking too much but is that difficult/impossible to get the folders that we want and truly ignore some local changes without the burden of stashing stuff at every merge and having a messy git status?