git file management tips

  • 2020-06-19 12:37:07
  • OfStack

untraked file files not tracked, usually newly created files

traked file is usually an indexed file

ignored ignored files, this type of file is usually in a list of 1 files. The file that maintains this list is named.gitignore in the version library root directory
Initializes the version library to ensure the just-created state


huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ ls 
hello 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ ls -a 
./ ../ .git/ hello 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ rm -rf .git/ hello 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo 
$ git init 
Initialized empty Git repository in C:/Users/huawei/Desktop/git-repo/.git/ 

Create a file to view the file type and find a file that is not tracked by untraked file


huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ echo "hello world" > hello 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ git status 
On branch master 
No commits yet 
Untracked files: 
 (use "git add <file>..." to include in what will be committed) 
  hello 
nothing added to commit but untracked files present (use "git add" to track) 

The files being tracked are usually indexed and can be viewed through git ES23en-ES24en-ES25en. For the ignored files, see the demo below and simply write the file name to the.gitignore file


huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ git status 
On branch master 
nothing to commit, working tree clean 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ echo "a" > a 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ git status 
On branch master 
Untracked files: 
 (use "git add <file>..." to include in what will be committed) 
  a 
nothing added to commit but untracked files present (use "git add" to track) 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ echo a >> .gitignore 
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) 
$ git status 
On branch master 
Untracked files: 
 (use "git add <file>..." to include in what will be committed) 
  .gitignore 
nothing added to commit but untracked files present (use "git add" to track) 

.ES30en file syntax

The line at the beginning of # is used for comments

Empty lines will be commented

The end of the directory name is marked with a backslash (/)

Contains shell wildcards, such as *. 32 debug/bit / *. o

The initial exclamation point is used to fetch the antipattern


Related articles: