Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
381 views
in Technique[技术] by (71.8m points)

git - 适用于git stash pop和git stash的区别(Difference between git stash pop and git stash apply)

I've been using git stash pop for quite some time.

(我一直在使用git stash pop一段时间了。)

I recently found out about the git stash apply command.

(我最近发现了git stash apply命令。)

When I tried it out, it seemed to work the same as git stash pop .

(当我尝试它时,它似乎与git stash pop 。)

What is the difference between git stash pop and git stash apply ?

(git stash popgit stash apply什么区别?)

  ask by Sandeep Raju Prabhakar translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

git stash pop throws away the (topmost, by default) stash after applying it, whereas git stash apply leaves it in the stash list for possible later reuse (or you can then git stash drop it).

(git stash pop在应用它之后抛弃 (最上面,默认情况下)stash,而git stash apply 将它留在隐藏列表中以便以后重用(或者你可以git stash drop it)。)

This happens unless there are conflicts after git stash pop , in which case it will not remove the stash, leaving it to behave exactly like git stash apply .

(除非在git stash pop之后发生冲突,否则会发生这种情况,在这种情况下它不会删除存储,使其行为与git stash apply完全相同。)

Another way to look at it: git stash pop is git stash apply && git stash drop .

(另一种看待它的方法: git stash popgit stash apply && git stash drop 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...