You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, there are two types of files: text files and binary files.
Text files, like most code files, are easily tracked with Git 📖 and are very lightweight.
However, binary files like spreadsheets, presentations with slides, and videos don't work well with Git. If your repository already has some of these files, it's best to have a plan in place before you enable Git version control.
You could choose to remove the binary files, or use another tool like git-lfs (Git Large File Storage). We won't get into detail on how to set up git-lfs in this course, but we will talk about .gitignore files next, which are key to protecting your code from becoming bloated with binaries.
Add a .gitignore
As mentioned above, there are files you won't want to store in Git. In addition to avoiding binaries, you will also want to keep build artifacts out of your version controlled code. As we convert your project to a Git repository, it should only include the source code necessary to build or compile your project.
To do this, you will create a file in your current project named .gitignore. When you switch over, Git will use the .gitignore to determine which files and directories should not be tracked under version control.
A .gitignore file should be committed into your repository in order to share the ignore rules with any other users that interact with the repository.
Since the files to be ignored are dependent on the language you are using, the open source community has contributed some great templates for .gitignore files in the github/gitignore repository.
Step 2: Prepare the project
Working with Binary files
In general, there are two types of files: text files and binary files.
Text files, like most code files, are easily tracked with Git 📖 and are very lightweight.
However, binary files like spreadsheets, presentations with slides, and videos don't work well with Git. If your repository already has some of these files, it's best to have a plan in place before you enable Git version control.
You could choose to remove the binary files, or use another tool like git-lfs (Git Large File Storage). We won't get into detail on how to set up git-lfs in this course, but we will talk about
.gitignore
files next, which are key to protecting your code from becoming bloated with binaries.Add a
.gitignore
As mentioned above, there are files you won't want to store in Git. In addition to avoiding binaries, you will also want to keep build artifacts out of your version controlled code. As we convert your project to a Git repository, it should only include the source code necessary to build or compile your project.
To do this, you will create a file in your current project named
.gitignore
. When you switch over, Git will use the.gitignore
to determine which files and directories should not be tracked under version control.A
.gitignore
file should be committed into your repository in order to share the ignore rules with any other users that interact with the repository.Since the files to be ignored are dependent on the language you are using, the open source community has contributed some great templates for
.gitignore
files in thegithub/gitignore
repository.⌨️ Activity: Prepare your repository
.gitignore
file. Use a template or create your own.Watch below for my response
The text was updated successfully, but these errors were encountered: