How to show all changes in visual studio git even after push

Issue

I have visual studio 2019.

  1. I write some code.
  2. Commit.
  3. 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)

Solution

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:

  1. View Branch History: This opens a window showing your branch history right now, and if you are tracking an upstream branch it will show outgoing and incoming commits as well. This view does not auto-refresh so you should use the refresh button in the upper left corner of the window to manually refresh it anytime you modify your branch. (Note you can also get to this view by right clicking on your checked out branch name in the bottom right corner of VS2019. If the fly-up branch list contains so many local branches that you can’t see your bolded branch, you can start typing in the search box to find it, then right click on your branch.)
  2. Manage Branches: This opens a window displaying all of the branches in your repo; local branches are first, and remote branches appear below it. You can simply click on any branch to see it’s history, and by default your branch will be selected first. This view auto-refreshes. (Note you can also get to the view by right clicking on your checked out branch name in the bottom right corner of VS2019, then in the fly-up at the top right click on the 3 dots menu and select "Manage Branches". Or, in your Git Changes Window at the top next to your branch name, there is a 3 dot menu with more options that also includes this.)

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.

Answered By – TTT

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published