Removing a directory from .gitignore so git starts to track changes in it

B.I.

I have a directory doc that was in .gitignore. I decided git should track changes in it. But after removing doc entry from .gitignore, git didn't automatically start tracking the directory.

How can I force git to watch for changes in that directory?

My second concern is, while looking for an answer to above question I found this thread: Ignore files that have already been committed to a Git repository and performed these operations:

git rm -r --cached .
git add .
git commit -m ".gitignore is now working"

I understand that it was wrong move; the above thread discussed totally opposite situation. Did I ruined something rather badly?

All this is done on a private, semi-serious project.

Thank you very much!

Philip Oakley

Git doesn't track directories at all, rather it tracks (file) content. It may be that you have other conditions in the .gitignore, particulalrly a !dir which then, as an optimisation in recent versions, no longer reads further gitignore files in any lower directories.

The gitignore capability is a powerful tool, but has traps for the unwary.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to use git to track changes in another directory?

From Dev

git merge into master removing changes from branch

From Dev

.gitignore: track a single file in an ignored directory

From Dev

gitignore shouldn't track files in subdirectory, but should track the directory structure

From Dev

Removing file from .git directory from previous commit

From Dev

Git ignoring a directory without .gitignore

From Dev

chrome.filesystem track directory to changes

From Dev

Track branch changes from a Makefile

From Dev

Removing a directory from PATH

From Java

Create a git patch from the uncommitted changes in the current working directory

From Dev

How to push changes to Git repository from uninitialized directory

From Dev

How to apply changes to working directory from local git repo?

From Dev

Git: Keep changes in local repo & remove from index after adding to .gitignore

From Dev

Removing .gitignore files from previous commits in GitHub

From Dev

Are .gitignore files from directories above the repository's or from home directory loaded in any versions of Git?

From Dev

How to track Django model changes with git?

From Dev

How does git track changes to files

From Dev

How to track Django model changes with git?

From Dev

How to not track an added, uncommitted file in Git without using .gitignore

From Dev

git push to Heroku does not create directory with .gitignore

From Dev

git subtree changes the package directory

From Dev

GIT clone changes to Windows directory

From Dev

"permission denied" while removing git directory

From Dev

git filter-branch is not removing my directory

From Dev

How to cancel a gitignore from a parent level directory

From Dev

git status is showing "Changes not staged for commit" for files listed in .gitignore?

From Dev

Removing commit from git history

From Dev

Removing build folder from git

From Dev

Removing git from /usr/bin

Related Related

  1. 1

    How to use git to track changes in another directory?

  2. 2

    git merge into master removing changes from branch

  3. 3

    .gitignore: track a single file in an ignored directory

  4. 4

    gitignore shouldn't track files in subdirectory, but should track the directory structure

  5. 5

    Removing file from .git directory from previous commit

  6. 6

    Git ignoring a directory without .gitignore

  7. 7

    chrome.filesystem track directory to changes

  8. 8

    Track branch changes from a Makefile

  9. 9

    Removing a directory from PATH

  10. 10

    Create a git patch from the uncommitted changes in the current working directory

  11. 11

    How to push changes to Git repository from uninitialized directory

  12. 12

    How to apply changes to working directory from local git repo?

  13. 13

    Git: Keep changes in local repo & remove from index after adding to .gitignore

  14. 14

    Removing .gitignore files from previous commits in GitHub

  15. 15

    Are .gitignore files from directories above the repository's or from home directory loaded in any versions of Git?

  16. 16

    How to track Django model changes with git?

  17. 17

    How does git track changes to files

  18. 18

    How to track Django model changes with git?

  19. 19

    How to not track an added, uncommitted file in Git without using .gitignore

  20. 20

    git push to Heroku does not create directory with .gitignore

  21. 21

    git subtree changes the package directory

  22. 22

    GIT clone changes to Windows directory

  23. 23

    "permission denied" while removing git directory

  24. 24

    git filter-branch is not removing my directory

  25. 25

    How to cancel a gitignore from a parent level directory

  26. 26

    git status is showing "Changes not staged for commit" for files listed in .gitignore?

  27. 27

    Removing commit from git history

  28. 28

    Removing build folder from git

  29. 29

    Removing git from /usr/bin

HotTag

Archive