What does Git mean the equivalent of TFS shelve / unshelve commands? cherry pick?

I found that shelve / unshelve commands in TFS are very convenient and very easy to use. What is equivalent in git?

here is the script in TFS:

  • I made a change in the trunk
  • I put: the change set is saved on the server (with label) and I return the source code before the changes
  • I work in the trunk
  • Someone might disable: get a change in their workspace

I know there is a cherry-pick command call, but I'm not sure about the workflow and if it works.

+55
git tfs
Jun 18 '10 at 13:27
source share
4 answers

What you are describing is similar to git stash , except that with git you have your own repository (and not just one to the server), only you can return this change.

General idea:

 # do some stuff vim foo/bar.c # stash away your changes git stash # do some other things... # retrieve your changes git stash pop 

If you want someone else to have access to this set of changes, you want to transfer it to the working branch instead:

 # make yourself a branch git checkout -b temp-featureA # commit to it git add foo/bar.c; git commit # now you push this branch (or they could just fetch straight from you) git push origin temp-featureA # Now, in someone else repo: # Fetch updates git fetch origin # Make a branch tracking the remote branch git branch temp-featureA origin/temp-featureA # Either check it out: git checkout temp-featureA # or cherry-pick it, to apply the changes somewhere else: git cherry-pick temp-featureA # or, if it multiple commits, rebase it! git rebase --onto my-branch start-of-featureA temp-featureA 
+67
Jun 18 '10 at 13:35
source share
β€” -

What you want to do is done with a simple old branch in git.

From https://stackoverflow.com/a/166269/2126/jarpar :

Shelving is a way to save all changes to your mailbox without checking. Changes are saved on the server.

This is similar to fixing a branch and moving it to a server in git.

How to do it:

Let's say you are working on a branch of "master" and you decide to implement function X. You start well with this, but then your boss tells you that function Y should be implemented as soon as possible. Phil in the next cube above the volunteers to finish function X while you show Y. Here's what you do:

Create a new branch and switch to it:

 $ git checkout -b feature-x 

Commit your changes:

 $ git add filethatyouchanged.cc $ git commit -m 'partial implementation of feature X' 

Click on the server Phil can see:

 $ git push origin feature-x 

Return to the main branch (which has not changed):

 $ git checkout master 

You can also proactively create a new branch for function Y:

 $ git checkout -b feature-y 

Phil can now roll back your work with function X and choose where you left off:

 phil$ git fetch origin phil$ git checkout -t origin/feature-x 
+21
Jun 18 2018-10-18
source share

git stash is a bit alike, except that it is limited to your working tree.

In DVCS, to achieve this kind of workflow, you need to:

  • commit current changes in a new branch
  • check the source branch, in which you can continue, without any changes that you entered (but were committed to a new branch)
  • push this new branch to the bare repo
  • Allow another developer to pull this new branch and merge it into the current branch.

Another way would be to allow another developer to get your branch (where you made this particular set of changes) and cherry picks , but this is not recommended, it’s hard to track cherries to track .

+5
Jun 18 '10 at 13:33
source share

You are looking for the stash command, I think. Link

+1
Jun 18 '10 at 13:34 on
source share



All Articles