Git not removing files when switching branch

后端 未结 3 1773
半阙折子戏
半阙折子戏 2020-12-04 17:40

Sometimes when switching branches using Git (version 1.7.2.1) it does not seem to remove the files/directories I created specific to the branch I switched away from. Neither

3条回答
  •  清歌不尽
    2020-12-04 18:18

    First:

    git reset --hard
    

    Reset the repository to the state of the last commit.
    Since git normally does not remove files it is not tracking those could still cause issues.

    Then:

    git clean -d --dry-run
    

    See what files would get deleted. We don't want to loose valuable work. and if that is ok:

    git clean -d
    

提交回复
热议问题