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 2 commits into
base: main
Choose a base branch
from
Open

add git-wip and git-unwip #669

wants to merge 2 commits into from

Conversation

acant
Copy link

@acant acant commented Jul 26, 2017

  • git-wip will commit all the changes in the working directory into a WIP commit
  • git-unwip will undo a WIP commit using git-undo

I have been using these commands for a while, to save interim changes when switching between feature branches. This ideas in other places, but it would be nice to included it here too. I have added links to files in https://github.com/ddollar/git-utils which are similar, but the scripts are not exactly the same.

Any feedback is welcome. I went through the contributing guidelines, but if I have missed anything I am happy to updated it.

Thanks in advance.

@acant acant force-pushed the feature/wip_unwip branch from aa5affa to 3a22a42 Compare July 30, 2017 02:28
@eMPee584
Copy link

Hm, kinda sounds like git stash to me.. Maybe you can check whether this is still useful today?

@acant
Copy link
Author

acant commented Jan 10, 2025

@eMPee584 it is very similar to git stash, I agree.
I do still use this script today. When I am working on multiple independent branches I find the wip commit easier to manage that trying to keep a stash of independent commits.
I also like being able to push the wip commits to a remote repo both for safe keeping or for sharing between laptop/desktop systems.

@acant acant force-pushed the feature/wip_unwip branch 3 times, most recently from 4501c4a to 71395a3 Compare January 12, 2025 17:02
@acant
Copy link
Author

acant commented Jan 12, 2025

Rebased onto main instead of master to clean up the conflicts.

Copy link
Collaborator

@hyperupcall hyperupcall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase! Generally looks good to me, had two suggestions

bin/git-unwip Outdated

if [ 'WIP' != $LAST_COMMIT ]; then
echo 'Last commit is not a WIP commit, so it will not be unWIP-ed.'
exit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exit
exit 1

I think this should be an error if it is unable "to unwip"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense I will update the commit. 👍

bin/git-unwip Outdated
# * 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:]'`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LAST_COMMIT=`git log -1 --pretty=%B | tr --delete '[:space:]'`
LAST_COMMIT=`git log -1 --pretty=%B | tr -d '[:space:]'`

BSD tr doesn't seem to support --delete

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that is unfortunate. I have been trying to use the full flag names in scripts, but you are right that BSD does not support it. ☹️

I will update to use -d as you suggested.

@acant acant force-pushed the feature/wip_unwip branch from 71395a3 to 8915f7c Compare January 24, 2025 05:02
@acant acant requested a review from hyperupcall January 24, 2025 05:03
@acant acant force-pushed the feature/wip_unwip branch 2 times, most recently from a792dac to 0165853 Compare January 26, 2025 00:00
@acant
Copy link
Author

acant commented Jan 26, 2025

@hyperupcall thanks for approving the workflow execution.

I have tried to fix the various failures in:

@acant acant force-pushed the feature/wip_unwip branch from 0165853 to 720beae Compare January 26, 2025 04:07
@acant
Copy link
Author

acant commented Jan 26, 2025

@hyperupcall thanks again for running the workflow.
Looks like I successfully fixed the build stage, but not the typo.

After some investigation is seems that the problem is the version of codespell, which does not include the inline ignore support.

I have created a separate commit to upgrade codespell, which updates tests/pyproject.tom and tests/poetry.lock.
I also ran the codespell command locally and it works on my machine.

Hopefully it will work in Github Actions too. 🤞

@hyperupcall
Copy link
Collaborator

Thanks! Inline ignoring seems to work fine, although CI still unfortunately fails on spellcheck. I haven't properly been able to look into it because of my schedule at the moment - though I will later

@hyperupcall
Copy link
Collaborator

hyperupcall commented Jan 27, 2025

I think probably the newer version of codespell is catching typos or "typos" that weren't caught before. Once those issues are fixed then I'll be able to merge this (to keep CI green on main). I'll be able to get around to doing it maybe in a week or two if its not already done

acant added 2 commits January 27, 2025 20:39
It is a lastet verison, and is needed so that I can use the inline
ignore support in a future commit.

After updating tests/pyproject.toml I ran the following commands:
```
cd tests
poetry lock --no-update
poetry install
```

I also fixed a spelling error in man/git-summary.md, which was not
caught by the old version of codespell. After updating the file I also
updated the related files by running the following commands:

```
cd man
make -C .. man/git-summary.{1,html}
```
Updated/re-built the documentation with:
```
cd man
make -C .. man/git-unwip.{1,html}
make -C .. man/git-wip.{1,html}
make -C .. man/git-extras.{1,html}
```
@acant acant force-pushed the feature/wip_unwip branch from 720beae to afe19c1 Compare January 28, 2025 01:40
@acant
Copy link
Author

acant commented Jan 28, 2025

@hyperupcall I fixed one problem, can caused another. 😆

I just updated the codespell commit to include the spelling fix, and updated the commit message. I re-ran codespell locally, and it seemed to report no errors. Hopefully it will run green now.

Thanks again for your time and attention, it is much appreciated.

@hyperupcall
Copy link
Collaborator

Fantastic! It's green now. Everything LGTM, I just have to pass it off to @spacewander now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants