Re: .gitignore does not ignore Makefile
W dniu 22.09.2016 o 20:26, Junio C Hamano napisał: > Kevin Daudt writes: > >> Often people advise tricks like `git update-index --assume-unchanges >> `, but this does not work as expected. It's merely a promise to >> git that this file does not change (and hence, git will not check if >> this file has changed when doing git status), but command that try to >> change this file will abort saying that the file has changed. > > It actually is even worse. As the user promised Git that the > will not be modified and will be kept the same as the version in the > index, Git reserves the right to _overwrite_ it with the version in > the index anytime when it is convenient to do so, removing whatever > local change the user had despite the promise to Git. The "abort > saying that the file has changed" is merely various codepaths in the > current implementation trying to be extra nice. There is a trick that works almost as 'ignore changes' for tracked files, namely `git update-index --skip-worktree `. From the documentation: Skip-worktree bit ~ Skip-worktree bit can be defined in one (long) sentence: When reading an entry, if it is marked as skip-worktree, then Git pretends its working directory version is up to date and read the index version instead. [...] Writing is not affected by this bit, content safety is still first priority. [...] It works quite well; the only problem is that `git stash` would not stash away your changes, and you would need to unmark such file before saving a stash. With --assume-unchanged used for ignoring changes to tracked files, you can quite easily lose your work because you are lying to Git. Note also that in Git classic "ignored" implies unimportant. -- Jakub Narębski
Re: .gitignore does not ignore Makefile
Timur Tabi writes: > So .gitignore only ignores new files, not modified ones? It is determines if an untracked file should be considered by "git add" to add it or ignore it.
Re: .gitignore does not ignore Makefile
Junio C Hamano wrote: It actually is even worse. As the user promised Git that the will not be modified and will be kept the same as the version in the index, Git reserves the right to_overwrite_ it with the version in the index anytime when it is convenient to do so, removing whatever local change the user had despite the promise to Git. The "abort saying that the file has changed" is merely various codepaths in the current implementation trying to be extra nice. So .gitignore only ignores new files, not modified ones? That seems odd, but I guess that's the way it's always been and I just haven't noticed until now. -- Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: .gitignore does not ignore Makefile
Kevin Daudt writes: > Often people advise tricks like `git update-index --assume-unchanges > `, but this does not work as expected. It's merely a promise to > git that this file does not change (and hence, git will not check if > this file has changed when doing git status), but command that try to > change this file will abort saying that the file has changed. It actually is even worse. As the user promised Git that the will not be modified and will be kept the same as the version in the index, Git reserves the right to _overwrite_ it with the version in the index anytime when it is convenient to do so, removing whatever local change the user had despite the promise to Git. The "abort saying that the file has changed" is merely various codepaths in the current implementation trying to be extra nice.
Re: .gitignore does not ignore Makefile
On Thu, Sep 22, 2016 at 09:19:22AM -0500, Timur Tabi wrote: > I have the following .gitignore file in patch arm/arm64/boot/dts: > > *.dtb > qcom > qcom.orig > > When I do a git status, I see this: > > modified: .gitignore > modified: qcom/Makefile > > All of the other files in arm/arm64/boot/dts/qcom are being ignored, > as request. However, the file "Makefile" is not being ignored. Why? > What's so special about "Makefile" that git refuses to ignore it? > There is nothing special about the Makefile, except that it's tracked. Git never ignores tracked files (almost a paradox). You can untrack the file by doing git rm --cached , which new commits won't have this file. If your goal is to ignore local changes to a tracked file, then the advise is to reconsider your plan. Often people advise tricks like `git update-index --assume-unchanges `, but this does not work as expected. It's merely a promise to git that this file does not change (and hence, git will not check if this file has changed when doing git status), but command that try to change this file will abort saying that the file has changed. Hope this helps, Kevin.
.gitignore does not ignore Makefile
I have the following .gitignore file in patch arm/arm64/boot/dts: *.dtb qcom qcom.orig When I do a git status, I see this: modified: .gitignore modified: qcom/Makefile All of the other files in arm/arm64/boot/dts/qcom are being ignored, as request. However, the file "Makefile" is not being ignored. Why? What's so special about "Makefile" that git refuses to ignore it? -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.