Quantcast
Channel: How do I name and retrieve a Git stash by name? - Stack Overflow
Browsing index pages (31 articles)
↧

Answer by Kostas Minaidis for How do I name and retrieve a Git stash by name?

TL;DRgit stash push -m "I will need this later"git stash apply stash^{/later}DescriptionGit CommandSave a stash with messagegit stash push -m "my_stash_name"List stashesgit stash listPop* n-th stashgit...

View Article


Answer by Lockszmith for How do I name and retrieve a Git stash by name?

There are a lot of answers, and most of them, especially the top ranked ones, serve a purpose and answer the original question.I'm sharing my git aliases that I've developed by following the details...

View Article


How do I name and retrieve a Git stash by name?

How do I save/apply a stash with a name? I don't want to have to look up its index number in git stash list. I tried git stash save "my_stash_name", but that only changes the stash description, and the...

View Article

Answer by Lily Ballard for How do I name and retrieve a Git stash by name?

Stashes are not meant to be permanent things like you want. You'd probably be better served using tags on commits. Construct the thing you want to stash. Make a commit out of it. Create a tag for that...

View Article

Answer by Adam Dymitruk for How do I name and retrieve a Git stash by name?

You can turn a stash into a branch if you feel it's important enough:git stash branch <branchname> [<stash>]from the man page:This creates and checks out a new branch named...

View Article


Answer by Sri Murthy Upadhyayula for How do I name and retrieve a Git stash...

To save a stash with a message:git stash push -m "my_stash_name"Alternatively (deprecated since v2.16):git stash save "my_stash_name"To list stashes:git stash listAll the stashes are stored in a...

View Article

Answer by Vlastimil Ovčáčík for How do I name and retrieve a Git stash by name?

Aliassapply = "!f() { git stash apply \"$(git stash list | awk -F: --posix -vpat=\"$*\" \"$ 0 ~ pat {print $ 1; exit}\")\"; }; f"Usagegit sapply "<regex>"compatible with Git for WindowsEdit: I...

View Article

Answer by Rohanthewiz for How do I name and retrieve a Git stash by name?

AliasThis might be a more direct syntax for Unix-like systems without needing to encapsulate in a function.Add the following to ~/.gitconfig under [alias]sshow = !sh -c 'git stash show stash^{/$*} -p'...

View Article


Answer by laur for How do I name and retrieve a Git stash by name?

For everything besides the stash creation, I'd propose another solution by introducing fzf as a dependency. I recommend taking 5 minutes of your time and get introduced to it, as it is over-all great...

View Article


Answer by Dan Rosenstark for How do I name and retrieve a Git stash by name?

Use git stash save NAME to save.Then... you can use this script to choose which to apply (or pop):#!/usr/bin/env ruby#git-stash-pick by Dan Rosenstark# can take a command, default is applycommand =...

View Article

Answer by Geoffrey Hudik for How do I name and retrieve a Git stash by name?

This is one way to accomplish this using PowerShell:<#.SYNOPSISRestores (applies) a previously saved stash based on full or partial stash name..DESCRIPTIONRestores (applies) a previously saved stash...

View Article

Answer by Pat Niemeyer for How do I name and retrieve a Git stash by name?

If you are just looking for a lightweight way to save some or all of your current working copy changes and then reapply them later at will, consider a patch file:# save your working copy changesgit...

View Article

Answer by N7L for How do I name and retrieve a Git stash by name?

This answer owes much to Klemen Slavič. I would have just commented on the accepted answer but I don't have enough rep yet :(You could also add a git alias to find the stash ref and use it in other...

View Article


Answer by Will Sheppard for How do I name and retrieve a Git stash by name?

Use a small bash script to look up the number of the stash. Call it "gitapply":NAME="$1"if [[ -z "$NAME" ]]; then echo "usage: gitapply [name]"; exit; figit stash apply $(git stash list | grep "$NAME"...

View Article

Answer by EssaidiM for How do I name and retrieve a Git stash by name?

git stash save is deprecated as of 2.15.x/2.16, instead you can use git stash push -m "message"You can use it like this:git stash push -m "message"where "message" is your note for that stash.In order...

View Article


Answer by iWheelBuy for How do I name and retrieve a Git stash by name?

I have these two functions in my .zshrc file:function gitstash() { git stash push -m "zsh_stash_name_$1"}function gitstashapply() { git stash apply $(git stash list | grep "zsh_stash_name_$1" | cut -d:...

View Article

Answer by Zack Morris for How do I name and retrieve a Git stash by name?

It's unfortunate that git stash apply stash^{/<regex>} doesn't work (it doesn't actually search the stash list, see the comments under the accepted answer).Here are drop-in replacements that...

View Article


Answer by gomes for How do I name and retrieve a Git stash by name?

Late to the party here, but if using VSCode, a quick way to do so is to open the command palette (CTRL / CMD + SHIFT + P) and type "Pop Stash", you'll be able to retrieve your stash by name without the...

View Article

Answer by kazuwombat for How do I name and retrieve a Git stash by name?

in my fish shellfunction gsap git stash list | grep ": $argv" | tr -dc '0-9' | xargs git stash applyendusegsap name_of_stash

View Article

Answer by A.H. for How do I name and retrieve a Git stash by name?

git stash apply also works with other refs than stash@{0}. So you can use ordinary tags to get a persistent name. This also has the advantage that you cannot accidentaly git stash drop or git stash pop...

View Article
Browsing index pages (31 articles)


Latest Images