-1

How can I add a full new directory with magit-status? When trying to stage a new directory from the magit-status buffer, pressing s, I can only add individual files within the directory, but not the directory itself (like if it were git add dir).

I'm not fully sure if some of the modes I've added to emacs its interfering with magit default behaviour, since I'm using a modified version from myself of the Purcell's configuration.

1

Git doesn't track directories, so "adding a directory" just means adding all of its current files.

If no files in that directory are currently tracked, it will appear as a directory name in the "Untracked files" section, and you can use s on the direcory name.

If some files in that directory are already tracked, you will see the untracked files in the "Untracked files" section, and you can mark the entire list as a region and type s to stage them all together.

You can also use : git add path/to/dir/ of course (including tab-completion).

  • Yeah I tried pressing s over the untracked dir but it didn't want to listen to me, and I finally added it on the command line. I'll try harder the next time. – Peregring-lk Jan 23 at 1:03
  • 1
    Type $ if magit fails to run a git command, to learn what the error was. – phils Jan 23 at 1:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.