I have visual studio 2019.
- I write some code.
- Commit.
- Push.
Now pending changes are gone.
Is there any way how can I have still all files in pending changes even after push? (all files that differ from main)
I have visual studio 2019.
Now pending changes are gone.
Is there any way how can I have still all files in pending changes even after push? (all files that differ from main)
2
Answers
After committing all staged changes, you have no more staged changes.
Once you have created a commit, you can see what is in that commit however:
git show <commit>
tl;dr: You can’t have them listed as pending changes, because they aren’t pending changes anymore. However, you can still easily see what you want. Skip down to the section "Now to finally answer your question" if you’re in a hurry.
When working with Git, I recommend having the history of your branch open in another window/tab pretty much all the time, and refresh it after any change you make to your branch (if your UI doesn’t auto-refresh it for you). The reason for this is by keeping an eye on your commits you’ll continuously validate that you’re doing exactly what you think you’re doing (especially important if you rebase frequently), and it also enables you to quickly look at any work you’ve already done when you want additional context. As your question points out, it’s common to desire this additional context, especially when you’re working on a feature with multiple commits.
When using Git in Visual Studio, there are two views that can display your branch history. Under the Git menu, there are two relevant options:
Note that both of these views contains icons at the top of the window to enable you display other local branches, remote branches, and tags, all in the same view if they are pointing to any of the same commits you can see in the current branch’s history.
Now to finally answer your question:
In either of the views described above, you can view the changes in any single commit, but you can also select two commits (left click on one commit, hold down the control key and left click on another commit), and then right click and select "Compare Commits…". By comparing the parent commit of your first commit (possibly
main
would be displayed there in your history if it hasn’t moved yet since you branched off of it), with your tip commit, you will see all the entire set of changes you made across all commits in your comparison. This should be what you wish to see while working on a feature.