-1

I have read that there is another way of ignoring files as mentioned in this article using the .git/info/exclude. I kinda like it because there is one file less in the directory. and anyway there will be one device where this program will be coming from. I dont mind not havingg version control on the .gitingnore

The simplified directory looks like this:

  • .git
  • vendor
  • index.php
  • sometext.txt

I would like to ignore vendor and the text file. How would i ignore them the command line way and the manual text edit on the .git/info/exclude. Also vendor has already been committed(and pushed) i would like for it not to be included in future pushes.

DrakeJest
  • 225
  • 3
  • 13
  • you should look for .gitignore, but what was versioned up to this point cannot be un-versioned. – Daemon Painter Apr 30 '20 at 15:58
  • @DaemonPainter that is the point, i do not want to use .gitignore. I want to approach it using the exclude file way – DrakeJest Apr 30 '20 at 16:25
  • Bear in mind that those excludes are _local_ and any clone of the repository will not have the same set of rules. As I said, as you already pushed, you'll also have to `git rm` it. – Daemon Painter Apr 30 '20 at 18:57
  • Does this answer your question? [How do I configure git to ignore some files locally?](https://stackoverflow.com/questions/1753070/how-do-i-configure-git-to-ignore-some-files-locally) – Daemon Painter Apr 30 '20 at 18:57

1 Answers1

1

Open an editor to modify this file .git/info/exclude to :

# Ignore directory vendor in repo's root only
/vendor/

# Ignore text file in repo's root only
/sometext.txt

This will be valid only for commits made after this change.

See Pattern Format for more details on the format to exclude or include files.

Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50
  • if i want to ingore a file inside a folder i assume that it would also look like this: `/folder/file.txt` and a folder inside a folder `/folder1/folder2/` ? Is there really no way of removing files that are pushed (exept of course making a new git project with the same files) – DrakeJest Apr 30 '20 at 17:12
  • @DrakeJest Yes you can use those patterns. There are ways to remove files that have been pushed but not without changing history. – Saurabh P Bhandari Apr 30 '20 at 17:18
  • Alright good to hear that, Thank you very much for your answer good sir – DrakeJest Apr 30 '20 at 17:31