Skip to content

Commit

Permalink
add git-wip and git-unwip
Browse files Browse the repository at this point in the history
  • Loading branch information
acant committed Jan 11, 2025
1 parent fea9667 commit 8efdcf4
Show file tree
Hide file tree
Showing 10 changed files with 465 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@
- [`git touch`](#git-touch)
- [`git undo`](#git-undo)
- [`git unlock`](#git-unlock)
<<<<<<< HEAD
- [`git utimes`](#git-utimes)
=======
- [`git unwip`](#git-unwip)
- [`git wip`](#git-wip)
>>>>>>> 3a22a42 (add git-wip and git-unwip)
## git extras

Expand Down Expand Up @@ -1595,3 +1600,21 @@ Abort current revert, rebase, merge or cherry-pick, without the need to find exa
## git magic
Commits changes with a generated message.
## 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
```
14 changes: 14 additions & 0 deletions bin/git-unwip
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions bin/git-wip
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions etc/git-extras-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,5 @@ zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
undo:'remove latest commits' \
unlock:'unlock a file excluded from version control' \
utimes:'change files modification time to their last commit date'
unwip:'undo a WIP commit' \
wip:'create a WIP commit'
51 changes: 51 additions & 0 deletions man/git-unwip.1
Original file line number Diff line number Diff line change
@@ -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>
122 changes: 122 additions & 0 deletions man/git-unwip.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions man/git-unwip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
git-unwip(1) -- Undo a Work In Progress commit
================================

## SYNOPSIS

`git-unwip`

## DESCRIPTION

Undo a Work In Progress commit.

## OPTIONS

None

## EXAMPLES

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

## AUTHOR

Written by Andrew Sullivan Cant &lt;<[email protected]>&gt;

## REPORTING BUGS

&lt;<https://github.com/tj/git-extras/issues>&gt;

## SEE ALSO

&lt;<https://github.com/tj/git-extras>&gt;
51 changes: 51 additions & 0 deletions man/git-wip.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-WIP" "1" "July 2017" "" ""
.
.SH "NAME"
\fBgit\-wip\fR \- Create a Work In Progress commit
.
.SH "SYNOPSIS"
\fBgit\-wip\fR
.
.SH "DESCRIPTION"
Create a Work In Progress commit, include all files in the working directory\.
.
.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 \fIAndrew Sullivan Cant\fR \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>
Loading

0 comments on commit 8efdcf4

Please sign in to comment.