Skip to content

Keeping your Fork clean with VS2015 Team Explorer

Sergey Nelga edited this page Aug 23, 2016 · 4 revisions

I love working with UI, but GitHub Desktop falls short on features, and forces you to work with Git Shell, if you want more advanced stuff. But one major thing which it doesn't do, is syncing your main GitHub fork origin/master with upstream, in this case - ProjectPorcupine TeamPorcupine/master. Apparently, by design, its only suppose to allow you to work only with your own fork.

Luckily VS2015 Team Explorer can do most of the things that Git Shell allows you to do, despite its minimalist appearance.

If you had previously tried to sync your fork using GitHub project page by making a Pull Request by reversing the base (for which you need a clean fork in the first place which is not ahead on commits) you will be left one commit ahead of upstream TeamPorcupine/master showing this merge. Which adds extra clutter.

You would need Git Shell to clean this up, but using Team Explorer from hence forth will spare you from returning to this state again. At this stage make sure you've branched out your work and master branch can be safely reset.

Select master branch. Clean your fork by resetting to unchanged state and push it. (http://stackoverflow.com/questions/9646167/clean-up-a-fork-and-restart-it-from-the-upstream)

git fetch TeamPorcupine master
git checkout master
git reset --hard TeamPorcupine/master
git push origin master --force

Now to update fork cleanly using Team Explorer:

  • In local TeamPorcupine folder switch(checkout) master branch, tracking TeamPorcupine/master, and select pull
  • Now switch to local master, tracking origin/master, and make a remote merge from TeamPorcupine/master.

  • Then Sync it.

Your GitHub fork page should say: This branch is even with TeamPorcupine:master.

Team Explorer also makes it easy to create and rebase your branches. And has a history feature.