diff --git a/Commands.md b/Commands.md index 0955783..4377530 100644 --- a/Commands.md +++ b/Commands.md @@ -4,6 +4,7 @@ - [`git authors`](#git-authors) - [`git changelog`](#git-changelog) - [`git clear`](#git-clear) + - [`git clear-soft`](#git-clear-soft) - [`git commits-since`](#git-commits-since) - [`git contrib`](#git-contrib) - [`git count`](#git-count) @@ -956,7 +957,11 @@ README.md ## git clear -Does a hard reset and deletes all untracked files from the working directory +Does a hard reset and deletes all untracked files from the working directory, including those in .gitignore. + +## git clear-soft + +Does a soft reset and deletes all untracked files from the working directory, excluding those in .gitignore. ## git merge-repo diff --git a/bin/git-clear b/bin/git-clear index 6d2d5e6..f08b75d 100755 --- a/bin/git-clear +++ b/bin/git-clear @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "Sure? - This command may delete files that cannot be recovered. [Y/n]" +echo "Sure? - This command may delete files that cannot be recovered, including those in .gitignore [Y/n]" read ans if [ "$ans" != "n" ] then git clean -d -f -x && git reset --hard diff --git a/bin/git-clear-soft b/bin/git-clear-soft new file mode 100755 index 0000000..003416a --- /dev/null +++ b/bin/git-clear-soft @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +echo "Sure? - This command may delete files that cannot be recovered. Files and directories in .gitignore will be preserved [Y/n]" +read ans +if [ "$ans" != "n" ] + then git clean -d -f && git reset --hard +fi diff --git a/man/git-clear-soft.1 b/man/git-clear-soft.1 new file mode 100644 index 0000000..46b2682 --- /dev/null +++ b/man/git-clear-soft.1 @@ -0,0 +1,35 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-CLEAR\-SOFT" "1" "May 2016" "" "" +. +.SH "NAME" +\fBgit\-clear\-soft\fR \- Soft clean up of a repository +. +.SH "SYNOPSIS" +\fBgit\-clear\-soft\fR +. +.SH "DESCRIPTION" +Clears the repository to a state that it looks as if it was freshly cloned with the current HEAD, however, preserving all changes that are located in files and directories listed in \.gitignore\. It is a git\-reset \-\-hard together with deletion of all untracked files that reside inside the working directory, excluding those in \.gitignore\. +. +.SH "EXAMPLES" +Clears the repo\. +. +.IP "" 4 +. +.nf + +$ git clear\-soft +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Modified version of script written by Daniel \'grindhold\' Brendle <\fIgrindhold@gmx\.net\fR> by Matiss Treinis <\fImrtreinis@gmail\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-clear-soft.html b/man/git-clear-soft.html new file mode 100644 index 0000000..f4c3380 --- /dev/null +++ b/man/git-clear-soft.html @@ -0,0 +1,114 @@ + + +
+ + +
+ git-clear-soft - Soft clean up of a repository
+
git-clear-soft
Clears the repository to a state that it looks as if it was freshly cloned + with the current HEAD, however, preserving all changes that are located in files and directories listed in .gitignore. It is a git-reset --hard together with + deletion of all untracked files that reside inside the working directory, excluding those in .gitignore.
+ +Clears the repo.
+ +$ git clear-soft
+
+
+Modified version of script written by Daniel 'grindhold' Brendle <grindhold@gmx.net> by Matiss Treinis <mrtreinis@gmail.com>
+ +<https://github.com/tj/git-extras/issues>
+ +<https://github.com/tj/git-extras>
+ + +Clears the repository to a state that it looks as if it was freshly cloned with the current HEAD. Basically it is a git-reset --hard together with - deletion of all untracked files that reside inside the working directory.
+ deletion of all untracked files that reside inside the working directory, including those in .gitignore.Written by Daniel 'grindhold' Brendle <grindhold@gmx.net>
+Written by Daniel 'grindhold' Brendle <grindhold@gmx.net>