Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2019 Github extension commands: "pop and restore staged" vs "pop all as unstaged"?

What is the difference between the following commands in Visual Studio 2019 for GIT stash? pop and restore staged (--index) pop All as unstaged

while using https://visualstudio.github.com/

like image 327
Nat Avatar asked Jun 07 '19 20:06

Nat


People also ask

What is pop and restore staged?

Pop: Applies the changes to the code branch and deletes the Stash. Pop and Restore Staged: Pops changes to code branch and ensures staging of previously staged files again. Pop All as Unstaged: Pops changes to code branch and won't stage files that were staged before.

How do I restore stashed changes in Visual Studio?

Restoring stashed changesIf you are not already on the branch where the changes are stashed, click Current Branch, then click the branch with stashed changes. In the left sidebar, click Stashed Changes. Click Restore.

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

git stash apply vs pop : They are almost similar except the fact that git stash pop throws away the (topmost, by default) stash when applying it, whereas git stash apply leaves it within the stash list for possible later use (or you'll then git stash drop it).

How do I Unstash in Visual Studio?

Generate a stash with custom options. Use stash only to generate a simple stash. Use Keep index to stash but keep all changes added to the index intact (besides stashing them). Use Include untracked if you want to stash also untracked files, leaving the working directory in a very clean state.


1 Answers

Found a good article : https://www.thomasclaudiushuber.com/2019/04/10/the-git-stash-functionality-in-visual-studio-2019 - and here is the answer:

  • Pop/Apply and Restore Staged – this will pop/apply the changes to your branch and it will also ensure that files that you had staged before are staged again
  • Pop/Apply All as Unstaged – this will pop/apply the changes to your branch and it won’t stage the files that you had staged before.

If you hadn’t any staged files before you created the stash, then you won’t see a difference between the two options.

like image 170
Nat Avatar answered Nov 12 '22 07:11

Nat