TFS命令的Git等价物搁置/不支持是什么?樱桃采摘? [英] what's the Git equivalent of TFS commands shelve/unshelve? cherry-pick?
问题描述
我发现TFS中的shelve / unshelve命令非常方便,使用起来非常简单。 Git中的等价物是什么?
这里是TFS中的场景:
<我知道有一个命令调用cherry-pick,但是我不确定工作流是否符合需求。
你描述的内容类似于 git stash
,除非你有自己的仓库(不仅仅是服务器上的一个仓库),只有你可以让这个更改回来。
总的想法是:
#做一些事情
vim foo / bar。 c
#储存您的更改
git储存
#做一些o其他的东西......
#找回你的修改
git stash pop
如果您希望其他人访问此更改集,则可以将其提交到工作分支:
#让自己成为一个分支
git checkout -b temp-featureA
#提交给它
git add foo / bar.c; git commit
$ b $#现在你推这个分支(或者他们可以直接从你那里获取)
git push origin temp-featureA
#现在,在别人的回购中:
#获取更新
git获取原点
#使分支跟踪远程分支
git分支temp-featureA原点/ temp-featureA
#检查出来:
git checkout temp-featureA
#或者樱桃挑选它,在其他地方应用更改:
git cherry-pick temp-featureA
#或者,如果它是多次提交,请将其重新绑定!
git rebase --onto my-branch start-of-featureA temp-featureA
I found that the shelve/unshelve commands in TFS are very handy and very simple to use. What's the equivalent in Git ?
here's the scenario in TFS :
- I made changes in the trunk
- I shelve : the change set is saved on the server (with a label) and I get the source back before the changes
- I work in the trunk
- Someone can unshelve : get the change set in his workspace
I know that there's a command call cherry-pick but i"m not sure of the workflow and if it fits the need.
What you describe is similar to git stash
, except since with git you have your own repository (not just a single one on a server), only you can get that change set back.
The general idea is:
# 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 wanted someone else to have access to this changeset, you'd want to instead commit it to a working branch:
# 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's 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's multiple commits, rebase it!
git rebase --onto my-branch start-of-featureA temp-featureA
这篇关于TFS命令的Git等价物搁置/不支持是什么?樱桃采摘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!