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
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
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
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
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.
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/
you can use the .gitignore then inside the .gitignore file include the folder name for example test/