2

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?

stilllife
  • 1,776
  • 1
  • 18
  • 38
  • possible duplicate of [use git smudge/clean to replace file contents](http://stackoverflow.com/questions/14282083/use-git-smudge-clean-to-replace-file-contents) – Oliver Charlesworth Jun 07 '14 at 17:09
  • possible duplicate of [GIT: Ignoring Version-Controlled Files](http://stackoverflow.com/questions/4633681/git-ignoring-version-controlled-files) – Matthew Strawbridge Jun 07 '14 at 18:15
  • possible duplicate of [Does .gitignore have an equivalent for version controlled files?](http://stackoverflow.com/questions/23835272/does-gitignore-have-an-equivalent-for-version-controlled-files) – jthill Jun 08 '14 at 00:19
  • [There's three general ways: whatever's reading that file, have it look at your version (kept elsewhere) first, use filters to keep the content in the worktree preserved and out of the repo, and tell git to pretend you didn't change the file.](http://stackoverflow.com/a/23837178/1290731) Once git's tracking a file, it's tenacious about it. – jthill Jun 08 '14 at 00:22

0 Answers0