I often add a new file to a repo, make some other changes, then stage all, and commit all, forgetting that the new file is not yet tracked, so is not included in the stage all step. At least one editor (IntelliJ) has an option to auto-stage new files, which would be very helpful to me in Emacs. I guess this would be particularly helpful if it invoked –intent-to-add.
Is this feature present in magit or built-in in Emacs?
If not, I’d be interested in writing some elisp. Is there a hook run when magit sees a new untracked file, or would I have to add to the after-save-hook and query the git status?
Magit does not implement this and as far as I know VC/Emacs does not do so either.
Magit also does not provide a hook that is run "when it sees a new untracked" file but you could use
find-file-hook, which is run when you see a untracked file. ;D
You probably want to use
magit-file-tracked-p in your hook function.
Correct answer by tarsius on December 12, 2020
0 Asked on September 2, 2021 by grepcake
0 Asked on September 2, 2021 by scientific_explorer
1 Asked on September 2, 2021 by aleks224
0 Asked on September 2, 2021 by a-blizzard
2 Asked on September 2, 2021 by lorem-ipsum
1 Asked on September 2, 2021 by omar113
3 Asked on February 27, 2021 by carsten
1 Asked on February 23, 2021 by witek
0 Asked on February 20, 2021
1 Asked on February 19, 2021 by tamifo
1 Asked on February 19, 2021 by vroomfondel
0 Asked on February 14, 2021 by omarali-linux
1 Asked on February 14, 2021
1 Asked on February 14, 2021 by jir
0 Asked on February 14, 2021
Get help from others!