diff --git a/Commands.md b/Commands.md index 228df36d2..a41ff4a72 100644 --- a/Commands.md +++ b/Commands.md @@ -65,6 +65,8 @@ - [`git touch`](#git-touch) - [`git undo`](#git-undo) - [`git unlock`](#git-unlock) + - [`git unwip`](#git-unwip) + - [`git wip`](#git-wip) ## git extras @@ -1349,3 +1351,21 @@ Sync local branch with origin/master ```bash $ git sync origin master ``` + +## git wip + +Create a Work In Progress(WIP) commit, which will include all changes in the +working directory. (i.e., changes to existing files, new files, removed files) + +```bash +$ git wip +``` + +## git unwip + +Undo A Work In Progress(WIP) commit and put all of those changes back into the +working directory. + +```bash +$ git unwip +``` diff --git a/bin/git-unwip b/bin/git-unwip new file mode 100755 index 000000000..50b85f464 --- /dev/null +++ b/bin/git-unwip @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Based on scripts from git-utils: +# * https://github.com/ddollar/git-utils/blob/master/git-unwip + +# Check if the last commit is a 'WIP' commit +LAST_COMMIT=`git log -1 --pretty=%B | tr --delete '[:space:]'` + +if [ 'WIP' != $LAST_COMMIT ]; then + echo 'Last commit is not a WIP commit, so it will not be unWIP-ed.' + exit +fi + +git undo diff --git a/bin/git-wip b/bin/git-wip new file mode 100755 index 000000000..a25d68fe7 --- /dev/null +++ b/bin/git-wip @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Based on scripts from git-utils: +# * https://github.com/ddollar/git-utils/blob/master/git-wip +# * https://github.com/ddollar/git-utils/blob/master/git-addremove + +git add --all +git commit --all --message="WIP" diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 2fc84c8fb..af0e7dec4 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -430,4 +430,6 @@ zstyle ':completion:*:*:git:*' user-commands \ sync:'sync local branch with remote branch' \ touch:'touch and add file to the index' \ undo:'remove latest commits' \ - unlock:'unlock a file excluded from version control' + unlock:'unlock a file excluded from version control' \ + unwip:'undo a WIP commit' \ + wip:'create a WIP commit' diff --git a/man/git-unwip.1 b/man/git-unwip.1 new file mode 100644 index 000000000..b4d094912 --- /dev/null +++ b/man/git-unwip.1 @@ -0,0 +1,51 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-UNWIP" "1" "July 2017" "" "" +. +.SH "NAME" +\fBgit\-unwip\fR \- Undo a Work In Progress commit +. +.SH "SYNOPSIS" +\fBgit\-unwip\fR +. +.SH "DESCRIPTION" +Undo a Work In Progress commit\. +. +.SH "OPTIONS" +None +. +.SH "EXAMPLES" +Create a WIP commit which stores all changes in the working directory\. +. +.IP "" 4 +. +.nf + +$ git wip +. +.fi +. +.IP "" 0 +. +.P +Later on, undo the commit and continue making changes\. +. +.IP "" 4 +. +.nf + +$ git unwip +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Andrew Sullivan Cant <\fImail@andrewsullivancant\.ca\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-unwip.html b/man/git-unwip.html new file mode 100644 index 000000000..039c70a32 --- /dev/null +++ b/man/git-unwip.html @@ -0,0 +1,122 @@ + + +
+ + +
+ git-unwip
- Undo a Work In Progress commit
+
git-unwip
Undo a Work In Progress commit.
+ +None
+ +Create a WIP commit which stores all changes in the working directory.
+ +$ git wip
+
+
+Later on, undo the commit and continue making changes.
+ +$ git unwip
+
+
+Written by Andrew Sullivan Cant <mail@andrewsullivancant.ca>
+ +<https://github.com/tj/git-extras/issues>
+ +<https://github.com/tj/git-extras>
+ + +
+ git-wip
- Create a Work In Progress commit
+
git-wip
Create a Work In Progress commit, include all files in the working directory.
+ +None
+ +Create a WIP commit which stores all changes in the working directory.
+ +$ git wip
+
+
+Later on, undo the commit and continue making changes.
+ +$ git unwip
+
+
+Written by Andrew Sullivan Cant mail@andrewsullivancant.ca
+ +<https://github.com/tj/git-extras/issues>
+ +<https://github.com/tj/git-extras>
+ + +