Home › Forums › Git (distributed revision control and source code management system) Tips /Tricks.. › git clean
- This topic has 0 replies, 1 voice, and was last updated 11 years, 1 month ago by
Humble.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
Humble
KeymasterMost of the times, we want to remove references to the ‘untracked files’ in the working directory.
For ex:
hchiramm@localhost libgfapi-python]$ git status # On branch master # Untracked files: # (use "git add
..." to include in what will be committed) # # .idea/ # doc/markdown/.dev_guide.md.swp # libgfapi-python-1.0.0.tar.gz # libgfapi-python.spec # libgfapi.egg-info/ # libgfapi/ # test/unit/results.html nothing added to commit but untracked files present (use "git add" to track) The easiest way of cleaning the 'untracked files/directories' are by 'git clean' command. BUT, before you execute the command make sure you are not deleting the right files. The best option is executing a 'dry-run' ( -n or --dry-run option) on the same before doing the actions. For ex: [hchiramm@localhost libgfapi-python]$ git clean -n Would remove doc/markdown/.dev_guide.md.swp Would remove libgfapi-python-1.0.0.tar.gz Would remove libgfapi-python.spec Would remove test/unit/results.html To remove directories you can make use of "-d" option.
[hchiramm@localhost libgfapi-python]# git clean -f -d Removing doc/markdown/.dev_guide.md.swp Removing libgfapi-python-1.0.0.tar.gz Removing libgfapi-python.spec Removing test/unit/results.html Removing libgfapi.egg-info/ Removing libgfapi/ [hchiramm@localhost libgfapi-python] Now my directory is "CLEAN"
[hchiramm@localhost libgfapi-python]# git status # On branch master nothing to commit, working directory clean [hchiramm@localhost libgfapi-python]#
-
AuthorPosts
Viewing 1 post (of 1 total)