Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add git-wip and git-unwip #669

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
```
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"
4 changes: 3 additions & 1 deletion etc/git-extras-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
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;<mail@andrewsullivancant.ca>&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