Git – Alternative to Shelveset in TFS

gitteam-foundation-server

I use git for my personal projects, so I have never run into any issues with Git, however I had a discussion at work today and its something that I haven't thought about.

In TFS you can store your changeset into a shelveset, this shelveset can be viewed by other developers, say for a peer review.

From what I understand in github you are working on your local copy of the repo (possibly with custom branches for different features) and then comes a point for a peer review. How would you go about sharing a specific changes on your local repo with someone else?

Best Answer

In Git, the basic model for pre-commit code review is to have a branch somewhere where it can bee reviewed, then merged with the main stream. This branch may be in the same repository as the main stream or in a completely separate one.

Some ways that I've seen done are:

  1. Push a branch to origin, and have the reviewers merge the changeset in when they're ready.
  2. Push a branch to a review repository or directly to the reviewer. Once reviewed the changeset may be pushed to the main repository.
  3. Use a tool like Gerrit to "catch" pushes and hold them until they're reviewed. Once the right people have confirmed the changeset is ready, Gerrit will merge it into the main branch.
  4. Using Github, Gitlab, Stash or another product, fork the original repository. Clone to your development machine and perform your changes. When finished, push to your fork and send a pull request to the original repository. This is the most common model in the open source world.
Related Topic