-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
introduce git-pstash (public stash) #410
base: main
Are you sure you want to change the base?
Conversation
} | ||
set_ref() | ||
{ | ||
ref=$(echo -n "$1" | tr ' \t' '_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change echo -n
to printf
?
I think this is a good idea. My thoughts: This is the differences I have noticed so far: $ git stash # and git stash save
No local changes to save
$ git pstash # and git pstash save
[pstash] branch: pstash, remote: origin, ref: refs/pstash/nicolai_pstash_wip
remote: warning: Deleting a non-existent ref.
To https://github.com/nicolaiskogheim/git-extras
- [deleted] refs/pstash/nicolai_pstash_wip' $ git stash [drop | show | apply | pop]
No stash found.
$ git pstash [drop | show | apply | pop]
ERROR: Please, specify stash name. # Or similar $ git stash clear
(no output)
$ git pstash clear
# option not supported, but silently falls back to doing 'git pstash' (see above) Local changes, empty (p)stash $ git stash [save] # Cleans working dir
Saved working directory and index state WIP on pstash: d076097 introduce git-pstash (public stash)
HEAD is now at d076097 introduce git-pstash (public stash)
$ git pstash [save] # Does not touch working dir
[pstash] branch: pstash, remote: origin, ref: refs/pstash/nicolai_pstash_wip
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 513 bytes | 0 bytes/s, done.
Total 5 (delta 4), reused 0 (delta 0)
To https://github.com/nicolaiskogheim/git-extras
* [new branch] 814beb0ff1f981042ce0c807a2ee4d71f802b5fd -> refs/pstash/nicolai_pstash_wip No local changes, entries in (p)stash $ git stash [ pop | apply ]
# Applies last stashed changes to work dir. Deletes stash entry if 'pop'.
# Runs git status
# If pop:
Dropped refs/stash@{0} (3e93e59b37acac04aad3acabe4bf32b0f61973a7)
$ git pstash [ pop | apply ] <stash name>
[pstash] branch: pstash, remote: origin, ref: refs/pstash/nicolai_pstash_wip
# If pop
[pstash] branch: pstash, remote: origin, ref: refs/pstash/nicolai_pstash_wip
git d4aead93ad77f81e11d0c1c0122f6007aac52e27 refs/pstash/nicolai_pstash_wip
To https://github.com/nicolaiskogheim/git-extras
Here is me mistyping git-extras git:(pstash) ✗ git pstash lsit
[pstash] branch: pstash, remote: origin, ref: refs/pstash/nicolai_pstash_wip
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 511 bytes | 0 bytes/s, done.
Total 5 (delta 4), reused 0 (delta 0)
To https://github.com/nicolaiskogheim/git-extras
* [new branch] 64fbdcdbae6f1afbc5b7a7c1c97ab79e40c8b108 -> refs/pstash/nicolai_pstash_wip Final thoughts: Again, mimicking |
Good notice, thank you. I agree that pstash will be better if it follows existing stash. Going to revise it. |
$ git pstash save | ||
``` | ||
|
||
Any of the above creates new stash with "${USER}_${current_branch_name}_wip" name. Your working directory is left untouched. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be wip/${USER}/${current_branch_name}
to follow branch name convention.
How are the revising going along, @phigoro? :) |
See also https://github.com/sarpik/git-backup -- I see that I've created a very similar feature:D Mine also supports including untracked changes, but it uses Though I haven't made it as clean as this one. I'd be great if we could merge'em up and have a useful command working. |
I think we should close this — it's quite out-of-date and old (6 years old). |
No description provided.