Ignoring unwanted files from github commit
Ignoring files
From time to time, there are files you don't want Git to check in to GitHub. There are a few ways to tell Git which files to ignore.
Create a local .gitignore
If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit.
1 ) In Terminal, navigate to the location of your Git repository.
2 ) Enter touch .gitignore to create a .gitignore file.
If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, youuntrack the file first, by running the following command in your terminal:
$ git rm --cached
OR
$
From time to time, there are files you don't want Git to check in to GitHub. There are a few ways to tell Git which files to ignore.
Create a local .gitignore
If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit.
1 ) In Terminal, navigate to the location of your Git repository.
2 ) Enter touch .gitignore to create a .gitignore file.
If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, youuntrack the file first, by running the following command in your terminal:
$ git rm --cached
OR
$
git rm --cached `git ls-files -i -X .gitignore`
Comments
Post a Comment