TECHNICAL SOLUTIONS

What is a Gitignore file on GitHub and how to create one easily


Have you ever heard of Gitignore? Not all of us, and that’s fine because there is no need for most people to know what it is. However, if you are the type of person who uses GitHub on a regular basis, then it is vital to know.

What is a Gitignore file in Github?

Gitignore file in Github

A regular user of GitHub would have probably come across a .gitignore file at some point. If you have no idea what it is all about, then worry not because we are going to explain what it is and what it is used for. Not only that, but we will discuss how to create a Gitignore file should you need one.

A Gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. It specifies intentionally untracked files that Git should ignore.

The ability to push files to a remote registry on GitHub is something you can do, and the same goes for staging files as well. If you do not wish to push files, you can choose not to and simply leave files out while performing the task of producing other files for a commit.

As it stands, then, the .gitignore file contains every file and folder you have no plans to push out to the remote repository. Furthermore, if you want to deploy files to specific cloud platforms, a Gitignore file is perfect for this as well.

Now, while a Gitignore file is very similar to other types of files used when working on projects, it should not be confused with files that take advantage of an appended .txt.

How to create a Gitignore file?

Now you know what a Gitignore file is, it is now time to create one of these files if you’re interested in doing so.

OK, so in order to create one of these files, you are required to visit the root folder of your project and create a new file. From there, give the file the name, .gitignore. The next step, then, is to open the newly created fine and proceed to type the characters of files and folders you plan to commit or ignore.

Like you would with any other file, just save your work on your Windows 10 computer. Finally, upload the .gitignore file to GitHub and watch as it refuses to stage or pick the files inside for a commit.

Read: Troubleshooting tips for linking GitHub or Google account with Microsoft Account.

What type of files can you add?

The idea is to include temporarily used folders and files that are unrelated to the project you’re working on. Additionally, if you have any uncompleted files from the same project, these can also be added to Gitignore should you wish.

We do not recommend using a Gitignore file every time, but it can simplify workflow from what we can tell.

Gitignore file in Github

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *