Reputation: 5830
I tried by saving a "unified diff", but couldn't find a way to apply it.
And patches work on commited changes, and I don't want commits without proper code reviews.
Ideas appreciated!
Upvotes: 23
Views: 17797
Reputation: 1
In Visual Studio, if you switch source control plugin from git to Visual studio team foundation server(Tools ->Options-> Source Control -> plugin selection). you can do same as TFS.
Upvotes: 0
Reputation: 595
Git has nothing that is as clean, elegant, and tied to personal space as TFS Shelvesets.
A Shelveset is made on the server, under your own personal bucket. Unlike a branch, it never shows up in the source tree, never muddies any common water. And it stores your work with the same guarantee of backup as committed code, without mixing it with the spaces of committed code.
We've used shelvesets for code review before commits, so that we're never really committing bad code anywhere. We use it as backups, so that I can keep work in a place that is safe, in case my workstations melts. Git accomplishes neither of these things, because any use of "branch" or "mirror" is an extra step that someone can mess up, that someone can forget to clean.
What Git does, however, is give you an exact spot at which review can happen... the pull request. If you're good with Git, you have to be good with committing bad code to your local repo, because that's just how things go without making peoples' lives complicated. Don't worry about reviews before Pulls, do reviews at Pulls.
Upvotes: 14
Reputation: 5231
git stash is the closest thing to a shelveset I have seen. It is a local pre commit copy that you can fetch into your branch once you start working on it again.
git stash
git checkout somebranch
git checkout branchwithstashedstuff
git stash pop
git stash pop combines a git stash apply and git stash drop against the latest stash.
If you have more then one stash you can do git stash list and git stash apply stash@{n} to get the nth stash.
Upvotes: 8
Reputation: 23556
Shelvesets are just temporary branches. So - just make new branch. Branches in Git are very lightweight so creating, pushing and removing from server is very simple and fast. You can name it i.e. wip-blabla
to notify that this is still unready.
Upvotes: 14
Reputation: 501
Commit did nothing but save changes to your "local" repository, which is quite a personal behavior. So what's the problem to CR after Commit but before Push?
For me, patch works well for the similar functionality as shelve-set.
Upvotes: 1
Reputation: 61
I think what you may want to do to mirror a shelve-set is to create another remote repository. git remote add "changesetname" "changeseturl" (Git allows you to have as many as you like) Upon the review process - you can merge changes from your changeset to your origin - then you can remove the changeset when you are finished.
Upvotes: 0