main에서 develop으로 checkout
할 때 다음과 같은 오류가 발생했다.
error: The following untracked working tree files would be overwritten by checkout:
FlipClock.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Please move or remove them before you switch branches.
Aborting
develop의 package파일이 main과 다르고, untrack(추적X) 하고 있기 때문에 checkout(브랜치 이동)할 때 overwritten
(덮어씌우게) 된다는 것 같다.
추적하지 않는 파일을 제거하면 된다.
# == 적용하지 않고 무엇을 해야할 지만 보고 싶을 때 ==
git clean -fd --dry-run # 또는
git clean -fdn
# == 적용하고 싶을 때 ==
git clean -fd
git clean
: 추적하지 않는 파일 삭제-fdn
: 옵션 메서드-f(--force)
: 강제 적용, 해당 옵션을 주지 않으면 특정 경우가 아닌경우 파일 또는 폴더 삭제를 거부합니다.-d
: 해당 옵션을 이용하여 untracked directory
도 추적하여 삭제하도록 지정할 수 있습니다(제가 잘 해석했는 지 모르겠네요. 아래가 본글입니다.).Normally, when no <path> is specified, git clean will not recurse into
untracked directories to avoid removing too much. Specify -d to have it
recurse into such directories as well. If any paths are specified, -d is
irrelevant; all untracked files matching the specified paths (with
exceptions for nested git directories mentioned under --force) will be
removed.
-n(--dry-run)
: 실제로 적용하지 않고, 어떻게 적용했는지를 알려줍니다.Don’t actually remove anything, just show what would be done.
-n(--dry-run)
적용 유무 차이