thinkPHP git upload, always some files do not pass up, .gitignore resolve

In the current path there is a .gitignore this document, which is to delete the asterisk, * is to ignore all files in the current directory upload.

For thinkPHP the git upload, the .gitignore in the thinkPHP delete it.

When we use git, sometimes do not want to pass some of the code-independent files to a remote repository, such as compiled files, .gitignore can help us deal with these files.

1. generate .gitignore file

Use the command touch .gitignore in git bash, you can generate a file in the current directory .gitignore

2. Edit the file .gitignore

In git bash, use the vi .gitignore can edit this file, then press Esc after the editor's note: the last input wq to save and exit express, enter q represents exit without saving. This operation in Linux terminal is the same.

3. Rules .gitignore file contents

/ Represents the directory

For example, / A / * A directory is to ignore all the content

* Indicates a match multiple characters

Iml file to ignore parts of it ending with * .iml

[] Represents a single character match multiple

[Abc] that represents any a, b, c in a character like

! Tracking represent certain types of files

For example /*,!*.c means to ignore all of the files, but the track end with .c, .c file this ending will not be ignored

How to delete a remote repository after using a previously uploaded file .gitignore such files while retaining a local file

For example, when we use git and github, and before did not write .gitignore file, you do not need to upload some files, after adding a .gitignore file, you wanted to delete files in the remote repository, but want to save the file locally.

This time not directly use git rm directory, this will delete the local file repository.

You can use git rm -r --cached directory to remove the buffer, then commit and push, it will find a remote repository unnecessary file is deleted, then you can directly use git add -A modified to add content, upload the contents of the file would be constrained .gitignore file.

Guess you like

Origin www.cnblogs.com/ymdphp/p/11088390.html