ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • git add 취소하기, 파일 상태를 Unstage로 변경하기
    Git & github 2020. 10. 21. 15:52

     

     

     

    git add 취소하기 - 파일 상태를 Unstage로 변경하기

     

    git add .   

    --> git add 명령어는 git에 저장되어 있는 HEAD의 위치에서 데이터가 수정되었거나, 새로 생겨난 데이터가 있을 때, Staging Area에 추가할 수 있는 명령어이다.

     하나의 파일을 추가할 때는 git add [ staging area에 올릴 파일명 ]을 입력하면 파일이 Staging Area에 올라간다.

    git add . 명령어를 통해서 작업한 모든 파일을 Staging Area에 넣은 경우, Staging Area (git add 명령을 수행한 후의 상태)에 넣은 파일을 목록에서 빼야 될 경우가 있다. 

     

     

     

    .gitignore 파일에 커밋에 반영하지 않을 파일들을 설정하였지만 반영되는것이 있어서 

    git add . 를 통해 올리지 않아야 될 파일들도 올라갔다.

    # Created by https://www.toptal.com/developers/gitignore/api/eclipse
    # Edit at https://www.toptal.com/developers/gitignore?templates=eclipse
    
    ### Eclipse ###
    .metadata
    bin/
    tmp/
    *.tmp
    *.bak
    *.swp
    *~.nib
    local.properties
    .settings/
    .loadpath
    .recommenders
    
    # External tool builders
    .externalToolBuilders/
    
    # Locally stored "Eclipse launch configurations"
    *.launch
    
    # PyDev specific (Python IDE for Eclipse)
    *.pydevproject
    
    # CDT-specific (C/C++ Development Tooling)
    .cproject
    
    # CDT- autotools
    .autotools
    
    # Java annotation processor (APT)
    .factorypath
    
    # PDT-specific (PHP Development Tools)
    .buildpath
    
    # sbteclipse plugin
    .target
    
    # Tern plugin
    .tern-project
    
    # TeXlipse plugin
    .texlipse
    
    # STS (Spring Tool Suite)
    .springBeans
    
    # Code Recommenders
    .recommenders/
    
    # Annotation Processing
    .apt_generated/
    .apt_generated_test/
    
    # Scala IDE specific (Scala & Java development for Eclipse)
    .cache-main
    .scala_dependencies
    .worksheet
    
    # Uncomment this line if you wish to ignore the project description file.
    # Typically, this file would be tracked if it contains build/dependency configurations:
    #.project
    
    ### Eclipse Patch ###
    # Spring Boot Tooling
    .sts4-cache/
    
    # End of https://www.toptal.com/developers/gitignore/api/eclipse

     

     

    MANIFEST.MF 파일과 pom.properties 파일 add를 취소해볼 것이다.

     

     

     

    1. 원래 git add에 대해 취소를 하는 명령어는 다음 명령어로 해야 된다.

    > git reset HEAD [ add를 취소할 파일명, 파일경로 ]

     

     

     

      

       MANIFESTMF 파일을 git add 한것에서 없애고 싶었는데, git status를 통해 statig area에 올라가있지 않은 것을 잘 확인할 수 있다. 

     

     

     

     

     

     

     

     

Designed by Tistory.