我发现TFS中的shelve/unshelve命令非常方便且易于使用.Git中的等价物是什么?
这是TFS中的场景:
我知道有一个命令调用樱桃选择,但我不确定工作流程,是否符合需要.
Cas*_*bel 81
你描述的是类似的git stash,除了你用git你有自己的存储库(不只是服务器上的一个存储库),只有你可以设置回来.
一般的想法是:
# do some stuff
vim foo/bar.c
# stash away your changes
git stash
# do some other things...
# retrieve your changes
git stash pop
Run Code Online (Sandbox Code Playgroud)
如果您希望其他人有权访问此更改集,您可能希望将其提交到工作分支:
# 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
Run Code Online (Sandbox Code Playgroud)
Nea*_*all 29
你想要做的是用git中的普通旧分支完成.
从一个不错的StackOverflow的答案被JaredPar:
搁置是一种在不签入的情况下保存盒子上所有更改的方法.更改将保留在服务器上.
这类似于提交分支并将其推送到git中的服务器.
假设您正在使用"主"分支,并决定实现功能X.您可以从中获得良好的开端,但随后您的老板会告诉您功能Y需要尽快实施.菲尔在下一个立方体中通过志愿者来完成功能X而你的功能是Y.这就是你做的:
创建一个新分支并切换到它:
$ git checkout -b feature-x
Run Code Online (Sandbox Code Playgroud)
提交您的更改:
$ git add filethatyouchanged.cc
$ git commit -m 'partial implementation of feature X'
Run Code Online (Sandbox Code Playgroud)
将它推送到Phil可以看到的服务器:
$ git push origin feature-x
Run Code Online (Sandbox Code Playgroud)
返回主分支(未更改):
$ git checkout master
Run Code Online (Sandbox Code Playgroud)
您可能还想主动为功能Y创建新分支:
$ git checkout -b feature-y
Run Code Online (Sandbox Code Playgroud)
Phil现在可以下载你的X功能,然后从你离开的地方开始:
phil$ git fetch origin
phil$ git checkout -t origin/feature-x
Run Code Online (Sandbox Code Playgroud)