Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: is there a functionality like the TFS shelveset?

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!

like image 423
Ariel Avatar asked Apr 09 '13 13:04

Ariel


People also ask

What is the advantage of git over TFS?

It keeps the history clean and avoids all those unreadable merges. Compared to our time with TFS, we have much less merge conflicts now are on Git. The main reason is that Git does a three-way merge because it knows exactly where two branches started to diverge.

What is Shelveset TFS?

Shelving lets you set store a batch of pending changes onto the server and optionally remove them from your local workspace. It comes in really handy for the times when you want to backup your code and store it on the server but don't want to commit it to source control.

What is git TFS?

git-tfs is a two-way bridge between TFS (Team Foundation Server) and git, similar to git-svn. It fetches TFS commits into a git repository, and lets you push your updates back to TFS. . See the change history for details and download.

How do I shelve a file in Git?

In the Commit tool window Alt+0 , right-click the files or the changelist you want to put to a shelf and select Shelve changes from the context menu. In the Shelve Changes dialog, review the list of modified files.


2 Answers

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.

like image 84
Hauleth Avatar answered Sep 20 '22 17:09

Hauleth


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.

like image 32
Darryl Braaten Avatar answered Sep 18 '22 17:09

Darryl Braaten