git ignore the rules and the file does not take effect .gitignore solution

text

  • Git ignore rules:

# This is a comment - Git content is ignored
.sample # ignore all files ending .sample
! Lib.sample # except lib.sample
TODO files under / TODO # only ignore the root directory of the project, not including subdir / TODO
Build / # ignore all files in the build / directory
DOC /
.txt # ignore doc / notes.txt but excluding doc / server / arch.txt

  • Solution .gitignore rule is not in effect
    to certain directories or files added to ignore the rules, defined as described above after the discovery did not take effect because .gitignore only to ignore those files had not been tracked, if some files have been included version management, modify .gitignore is invalid. Then the solution is to first delete the local cache (not track changes to the state), and then submitted to:
git rm -r --cached .
git add . git commit -m 'update .gitignore' 

The following is an example of content iOS .gitignore

#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/ ## Various settings *.xcuserstate *.DS_Store *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ ## Other *.moved-aside *.xccheckout *.xcscmblueprint ## Obj-C/Swift specific *.hmap *.ipa *.dSYM.zip *.dSYM # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/#source-control fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output # Code Injection # # After new code Injection tools there's a generated folder /iOSInjectionProject # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/

Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Guess you like

Origin www.cnblogs.com/qingfenglin/p/12620393.html