madskristensen / GitPull

Easy way to "git pull" in Visual Studio
Other
16 stars 10 forks source link

Pull all branches in the repository #1

Closed jcansdale closed 5 years ago

jcansdale commented 5 years ago

Rather than pulling just the current branch, pull all branches in the repository and delete branches that appear merged and have had their upstream branch deleted.

This means that if the user changes to a different branch, this branch will already be up to date and there will be no need to pull again with the solution loaded (which can be expensive and trigger project/solution reloads).

This implementation embeds hub and executes the sync command, see: https://hub.github.com/hub-sync.1.html

image

When text is written the the Output pane before it has been activated, the window can appear blank. Here is an example form the Learn the Shortcut extension:

image

To avoid this and let the user know when something is happening, this PR will activate the Output window immediately before creating a pane and writing any output.

If no branches require syncing and there is nothing to output, the following message will appear on the status bar:

image

madskristensen commented 5 years ago

Dude, this is amazing!!!!

madskristensen commented 5 years ago

A couple of questions:

  1. If there are local changes and a pull is executed automatically, what happens if there are merge conflicts?
  2. Should there be a setting that prevents local branches from being deleted?
madskristensen commented 5 years ago

Also, perhaps this extension should be renamed to Git Sync or something similar. Thoughts?

jcansdale commented 5 years ago

@madskristensen,

If there are local changes and a pull is executed automatically, what happens if there are merge conflicts?

I think in that case the following would apply.

We could automatically show the Team Explorer - Synchronization page in this situation?

image

Should there be a setting that prevents local branches from being deleted?

As long as we're never deleting unpublished commits, I wouldn't worry about it too much. I'm terrible for leaving old branches around, so this will definitely help me. 😄

Also, perhaps this extension should be renamed to Git Sync or something similar. Thoughts?

Yes, I think that might be an idea. Since it doesn't merge in new commits (only warns about them), I guess it isn't technically ding a pull (which is a fetch+merge). Git Sync is maybe a better description of what it's doing.

There is a related type of syncing that is a hassle and easy to forget about when you're working on a fork. That is syncing branches with the upstream repo. https://help.github.com/articles/syncing-a-fork/

Maybe the extension could offer to do this as well in a future version (if the user has an upstream remote defined). 🤔