Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is gitignore a file types or something that can be added on to files? Can I change a .txt file to .gitignore?

I’m new to github and recently created my first repo. I was wondering if gitignore is a completely different file type, or can it be added on to other files.

If gitignores can be added on to other files: I have a .txt file called words.txt. How do I change this into a .gitignore.txt file?

If gitignores are a completely different file type: How are gitignores helpful and where can they be used?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks!

>Solution :

Gitignore files are a specific file type.

When you’re working in your copy, Git watches every file in and considers it in three ways:

  • Tracked: You’ve already staged or committed the file.
  • Untracked: You’ve not staged or committed.
  • Ignored: You’ve explicitly told Git to ignore the file(s).

The .gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo.

The .gitignore file itself is a plain text document.

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
vendor/ 
  • * is used as a wildcard match *.exe will ignore any file with the .exe extension
  • / will ignore directories with the name. vendor/ ignores the vendor directory.
  • # will comment the line
  • […] will ignore values with any of the values.
    *.[abc] ignores files file.a, file.b, file.c.
    .[a-.[oa]d] the dash will include a range, in this case, file extensions a-d.

You may want to ignore certain files for multiple reasons:

  • The files contain sensitive data.
  • The files are system specific and do not need to exist on every machine’s copy.
  • Excluding the files maintains system security rules and privileges. (Remember, Git repos only contain the files necessary to get tech support—not to share the entire software.)
  • Binary, build assets, environment related..

Source: https://www.bmc.com/blogs/gitignore

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading