user4493177
user4493177

Reputation: 790

phpstorm Git commit directory adds other directories

I am using IDE PhpStorm with github support.

I have made changes to files in a certain directory. I want to commit and push those changes.

On that folder i press: Rightclick > Git > Commit directory

Up untill now that has always worked, but now suddenly it also commits file from other directories.

Next to that, all my files have turned red, but when i press compare with branch the files show no changes.

Any idea what is causing this behaviour and how i can commit only that directory?

Upvotes: 1

Views: 708

Answers (2)

unrivaledcreations
unrivaledcreations

Reputation: 938

In phpStorm, any files that appear in red are not a part of your git repository. Only files that are green (modified files) or blue (new files). You should review your files in the 1: Project pane of phpStorm to make sure you have the right files in your repository to begin with.

Next, visit your 9: Version Control pane of phpStorm to review the status of new or modified files. Enable the directory view here by clicking the [Folder] icon (see screenshot). Then click the Expand All icon (first option, top of right column in the 9: Version Control pane) to reveal all of the files that git thinks you need to commit. From here, right-click the folder (or even individual files!) you want to commit and let it rip!

Important: Only folders you have added to git will appear in the 9: Version Control pane, so if you haven't added individual folders to git yet, you can't commit them.

enter image description here

Because git is so incredibly efficient at storing changes to your files, it is best to just commit all the files anyways, but you can pick which folders or individual files to commit from here at will.

Upvotes: 3

Luke
Luke

Reputation: 1806

If you want to remove a directory/file from git repository:

  • In Phpstorm select Tools -> Run Command
  • Enter git rm directoryYouWantToRemove

See How can I delete a file from git repo?

If you want to let git ignore files or directories

Create a file called "gitignore"

List all files or directories in this file by simply adding the name of the file or directory on each line.

For example in that file just fill in the name of the directory in gitignore:

directoryYouWantToIgnore

More information: http://git-scm.com/docs/gitignore

Upvotes: 0

Related Questions