1

I am using the Cocoapod , RxCocoa , RxSwift and Git.

When I run the "git status", some warning will show:

(use "git restore ..." to discard changes in working directory)
modified: Pods/RxCocoa.d
modified: Pods/RxRelay.d
modified: Pods/RxSwift.d

I remember "Pod/*.a Pod/.dia" show too.

How to prevent this in the future?
Must I add something into the .gitignore file??

===================== Edit again:

I viewed the .gitignore a few minutes ago.

My project doesn't ignore the Pods. My project ignore the files in this way:


# Xcode
*.build
*.dia
*.tlog
*.o
*.d


In my opinion, I need't ignore the ".d" ".a" ".dia" files which are in the file "Pods/", need I?

jiexishede
  • 2,473
  • 6
  • 38
  • 54

1 Answers1

0

You could ignore Pods altogether:

echo Pods/>.gitignore
git rm --cached -R Pods/

But ignoring Pods has its Pros and Cons, so make sure this would work with your development workflow.


If your .gitignore already had *.d for instance, you can make sure that rule applies with:

git rm --cached -R Pods/*.d

(same for *.a, and so on)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @jiexishede I have updated the answer after your latest update. – VonC Dec 28 '21 at 11:21
  • Note to self: That was my **27000th answer** on Stack Overflow (in 160 months), a bit less than 6 months after the [26000th answer](https://stackoverflow.com/a/68190336/6309). Before that: [25000th answer](https://stackoverflow.com/a/65370954/6309), [24000th answer](https://stackoverflow.com/a/62688871/6309), [23000th answer](https://stackoverflow.com/a/59853332/63099), [22000th answer](https://stackoverflow.com/a/57387243/6309), [21000th answer](https://stackoverflow.com/a/54856158/6309), [20000th answer](https://stackoverflow.com/a/51915541/6309), ... – VonC Dec 29 '21 at 23:18