How do you “update” a stash?

Nick

In my current branch I have several stashes:

  • stash@{0}
  • stash@{1}
  • stash@{2}
  1. If I apply stash@{0}:

    $ git stash apply stash{0}
    
  2. Modify this stash

  3. I want to save the changes to the current stash stash@{0}

I don't want to create a 4th stash I just want to update the first stash.

Can someone tell how to do this? I'm looking at the man page… perhaps I'm overlooking something.

Lie Ryan

You can stash your working tree and then drop the old one that you don't need.

git stash apply
# Make changes
git stash
git stash drop stash@{1}

Alternatively, you can pop instead of apply, which will drop the stash at the same time:

git stash pop 
# make changes
git stash

Another alternative, if you already were already making the changes that you want to do before realizing that you want to merge the changes to the top of the stash:

# make changes
git add <all files>
git stash pop # or apply
git rm --cached <files that you want to merge>
git stash --keep-index

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How do I properly git stash/pop in pre-commit hooks to get a clean working tree for tests?

来自分类Dev

How do you declare a global constant in Python?

来自分类Dev

How would you do this tricky subsetting in R?

来自分类Dev

How do You Build an RSS feed with Jade?

来自分类Dev

How do you initialize and present a custom SLComposeServiceViewController?

来自分类Dev

How do you convert a dictionary to a ConcurrentDictionary?

来自分类Dev

How do you sort list of strings in batch?

来自分类Dev

How do you round decimal of an expression in mathematica

来自分类Dev

How do you match a trait in rust?

来自分类Dev

How do you stop a bash shell expansion?

来自分类Dev

当git stash内置调用update-index时出错

来自分类Dev

How do I do a simple "Update [table] where [anyfield] = [anyvalue]

来自分类Dev

How do you JOIN tables to a view using a Vertica DB?

来自分类Dev

How do you quickly close a nonresponsive websocket in Java Spring Tomcat?

来自分类Dev

how do you easily create tables in spring mvc

来自分类Dev

How do you show the current time on a web page?

来自分类Dev

Web API OData: How do you $expand on a single entity?

来自分类Dev

How do you get the file size of an image on the web page with Javascript?

来自分类Dev

How do you change background color in the settings of JetBrain's IDE?

来自分类Dev

how do you get the name of the current route with Meteor Iron Router?

来自分类Dev

VB.NET Custom Listview - How do you get the imagelist?

来自分类Dev

How do you map a keyboard key in Python 2.7?

来自分类Dev

How do you test a Backbone Marionnette method inside of onShow in Jasmine?

来自分类Dev

How do you access private variables using public functions?

来自分类Dev

R: how do you merge/combine two environments?

来自分类Dev

How do you run a scheme program in the terminal of Ubuntu?

来自分类Dev

How do you build PoDoFo on Windows with libcrypto support?

来自分类Dev

How do you count misspelled fields using a SQL query?

来自分类Dev

How do you set a Calendar ID when inserting in Google API?

Related 相关文章

  1. 1

    How do I properly git stash/pop in pre-commit hooks to get a clean working tree for tests?

  2. 2

    How do you declare a global constant in Python?

  3. 3

    How would you do this tricky subsetting in R?

  4. 4

    How do You Build an RSS feed with Jade?

  5. 5

    How do you initialize and present a custom SLComposeServiceViewController?

  6. 6

    How do you convert a dictionary to a ConcurrentDictionary?

  7. 7

    How do you sort list of strings in batch?

  8. 8

    How do you round decimal of an expression in mathematica

  9. 9

    How do you match a trait in rust?

  10. 10

    How do you stop a bash shell expansion?

  11. 11

    当git stash内置调用update-index时出错

  12. 12

    How do I do a simple "Update [table] where [anyfield] = [anyvalue]

  13. 13

    How do you JOIN tables to a view using a Vertica DB?

  14. 14

    How do you quickly close a nonresponsive websocket in Java Spring Tomcat?

  15. 15

    how do you easily create tables in spring mvc

  16. 16

    How do you show the current time on a web page?

  17. 17

    Web API OData: How do you $expand on a single entity?

  18. 18

    How do you get the file size of an image on the web page with Javascript?

  19. 19

    How do you change background color in the settings of JetBrain's IDE?

  20. 20

    how do you get the name of the current route with Meteor Iron Router?

  21. 21

    VB.NET Custom Listview - How do you get the imagelist?

  22. 22

    How do you map a keyboard key in Python 2.7?

  23. 23

    How do you test a Backbone Marionnette method inside of onShow in Jasmine?

  24. 24

    How do you access private variables using public functions?

  25. 25

    R: how do you merge/combine two environments?

  26. 26

    How do you run a scheme program in the terminal of Ubuntu?

  27. 27

    How do you build PoDoFo on Windows with libcrypto support?

  28. 28

    How do you count misspelled fields using a SQL query?

  29. 29

    How do you set a Calendar ID when inserting in Google API?

热门标签

归档