1

I am using git, and i do not want to add, commit some folder but it show me in modified files. How can stop this.

it show me in

git status
  • Update us with what the nature of this folder is. Does this folder contain source files which you would _eventually_ want to commit to your repository? Does the folder contain local config files? Or, is it something else? – Tim Biegeleisen Jul 04 '16 at 05:02

5 Answers5

1

To unstage a file or folder which you accidentally added, use git checkout -- path/to/file_or_folder:

git checkout -- path/to/your/file.ext

or

git checkout -- path/to/your/folder
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
1

Step 1. Add the folder path to your repo's root .gitignore file.

path_to_your_folder/

Step 2. Remove the folder from your local git tracking, but keep it on your disk.

git rm -r --cached path_to_your_folder/

Step 3. Push your changes to your git repo.

The folder will be considered "deleted" from Git's point of view (i.e. they are in past history, but not in the latest commit, and people pulling from this repo will get the files removed from their trees), but stay on your working directory because you've used --cached.

Reference : Remove a folder from git tracking

Community
  • 1
  • 1
Twinkle
  • 514
  • 3
  • 8
1

You can add specific files by the following command.

git add filename

and then commit the code. You will be able to push only the specified files in this case.

Also, as an alternative you can update .gitignore file and specify the files what you don't want to commit.

0

If you want to ignore it permanently, add it to .gitignore file.

Just create a file in your repo with .gitignore filename and add relative folder path there.

Here is the documentation link - https://help.github.com/articles/ignoring-files/

0

you can use the .gitignore then inside the .gitignore file include the folder name for example test/

Michael
  • 131
  • 1
  • 2