Tools/Git
git add * vs git add .
욱둥
2023. 4. 7. 00:47
git add * VS git add .
git을 로컬에서 사용할 때 터미널을 이용해서 사용한다.
보통
- $ git init
- $ cat > test.txt
- $ git add test.txt
- $ git commit -m " add test.txt "
이런식으로 사용한다.
그러나 파일이 여러개일 경우
$ git add * 로 모든 파일을 staged 상태로 만든다.
그런데 가끔 $ git add *을 하면 다음과 같은 상황이 나올때가 있다.
git add * The following paths are ignored by one of your .gitignore files: git-add/ignore.txt
Use -f if you really want to add them.

이 말은 .gitignore 에 현재 staged로 변경할 파일의 이름이 있다는 것이다
.gitignore로 git에 안올린다고 했는데 git add *로 다 올린다고 하니 다시 확인 하라는 말이다.
$ git add . 은 .gitignore에 있는 파일은 제외하고 staged에 올린다.
$ git add . 을 사용해서 staged에 올리자!