© CCFOUND sp. z o.o. sp.k.

Wie schließe ich eine ausgewählte Datei von der GIT-Code-Kontrolle aus?

In einem von GIT gesteuerten Projekt habe ich eine Datei, die ich von der Codekontrolle ausschließen möchte - sie soll ohne "Tracking" sein und nicht über den "Push"-Befehl funktionieren. Welcher GIT-Befehl, um dies zu tun?
In einem von GIT gesteuerten Projekt habe ich eine Datei, die ich von der Codekontrolle ausschließen möchte - sie soll ohne "Tracking" sein und nicht über den "Push"-Befehl funktionieren. Welcher GIT-Befehl, um dies zu tun?
Show original content

9 users upvote it!

2 answers


r

You should have a .gitignore file in the root of your project. If it's not there, you need to create it (in any text editor).

To this file you can add the names of files / directories to be ignored by git. If you absolutely want to do it from the command line, here is an example of adding the file "readme.txt" to the ignore list:

echo readme.txt >>.gitignore

You should have a .gitignore file in the root of your project. If it's not there, you need to create it (in any text editor).

To this file you can add the names of files / directories to be ignored by git. If you absolutely want to do it from the command line, here is an example of adding the file "readme.txt" to the ignore list:

echo readme.txt >>.gitignore

Machine translated


4 likes

O
To exclude a selected file from GIT control, you should use the command: git rm --cached file_name. You can also add the file name to the .gitignore file so it will not be added to the tracked files. This way, changes will not be recorded.
To exclude a selected file from GIT control, you should use the command: git rm --cached file_name. You can also add the file name to the .gitignore file so it will not be added to the tracked files. This way, changes will not be recorded.

Machine translated