Skip to content

Commit 062e7eb

Browse files
authored
Merge pull request #41793 from github/repo-sync
Repo sync
2 parents 066d64e + e77f16a commit 062e7eb

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

content/get-started/getting-started-with-git/ignoring-files.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ versions:
1616
---
1717
## Configuring ignored files for a single repository
1818

19-
You can create a _.gitignore_ file in your repository's root directory to tell Git which files and directories to ignore when you make a commit.
20-
To share the ignore rules with other users who clone the repository, commit the _.gitignore_ file in to your repository.
19+
You can create a `.gitignore` file in your repository's root directory to tell Git which files and directories to ignore when you make a commit.
20+
To share the ignore rules with other users who clone the repository, commit the `.gitignore` file in to your repository.
2121

22-
GitHub maintains an official list of recommended _.gitignore_ files for many popular operating systems, environments, and languages in the `github/gitignore` public repository. You can also use gitignore.io to create a _.gitignore_ file for your operating system, programming language, or IDE. For more information, see "[github/gitignore](https://github.com/github/gitignore)" and the "[gitignore.io](https://www.gitignore.io/)" site.
22+
GitHub maintains an official list of recommended `.gitignore` files for many popular operating systems, environments, and languages in the "github/gitignore" public repository. You can also use gitignore.io to create a `.gitignore` file for your operating system, programming language, or IDE. For more information, see "[github/gitignore](https://github.com/github/gitignore)" and the "[gitignore.io](https://www.gitignore.io/)" site.
2323

2424
{% data reusables.command_line.open_the_multi_os_terminal %}
2525
1. Navigate to the location of your Git repository.
26-
1. Create a _.gitignore_ file for your repository.
26+
1. Create a `.gitignore` file for your repository.
2727

2828
```shell
2929
touch .gitignore
3030
```
3131

3232
If the command succeeds, there will be no output.
3333

34-
For an example _.gitignore_ file, see "[Some common .gitignore configurations](https://gist.github.com/octocat/9257657)" in the Octocat repository.
34+
For an example `.gitignore` file, see "[Some common .gitignore configurations](https://gist.github.com/octocat/9257657)" in the Octocat repository.
3535

3636
If you want to ignore a file that is already checked in, you must untrack the file before you add a rule to ignore it. From your terminal, untrack the file.
3737

@@ -41,25 +41,19 @@ git rm --cached FILENAME
4141

4242
## Configuring ignored files for all repositories on your computer
4343

44-
You can also create a global _.gitignore_ file to define a list of rules for ignoring files in every Git repository on your computer. For example, you might create the file at _~/.gitignore_global_ and add some rules to it.
44+
You can tell Git to always ignore certain files or directories when you make a commit in any Git repository on your computer. For example, you could use this feature to ignore any temporary backup files that your text editor creates.
4545

46-
{% data reusables.command_line.open_the_multi_os_terminal %}
47-
48-
1. Configure Git to use the exclude file _~/.gitignore_global_ for all Git repositories.
49-
50-
```shell
51-
git config --global core.excludesfile ~/.gitignore_global
52-
```
46+
To always ignore a certain file or directory, add it to a file named `ignore` that's located inside the directory `~/.config/git`. By default, Git will ignore any files and directories that are listed in the global configuration file `~/.config/git/ignore`. If the `git` directory and `ignore` file don't exist yet, you may need to create them.
5347

5448
## Excluding local files without creating a _.gitignore_ file
5549

56-
If you don't want to create a _.gitignore_ file to share with others, you can create rules that are not committed with the repository. You can use this technique for locally-generated files that you don't expect other users to generate, such as files created by your editor.
50+
If you don't want to create a `.gitignore` file to share with others, you can create rules that are not committed with the repository. You can use this technique for locally-generated files that you don't expect other users to generate, such as files created by your editor.
5751

58-
Use your favorite text editor to open the file called _.git/info/exclude_ within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.
52+
Use your favorite text editor to open the file called `.git/info/exclude` within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.
5953

6054
{% data reusables.command_line.open_the_multi_os_terminal %}
6155
1. Navigate to the location of your Git repository.
62-
1. Using your favorite text editor, open the file _.git/info/exclude_.
56+
1. Using your favorite text editor, open the file `.git/info/exclude`.
6357

6458
## Further Reading
6559

0 commit comments

Comments
 (0)