【发布时间】:2015-11-15 09:44:27
【问题描述】:
我经常遇到这个问题(这个工作流程在 python 上很有意义):
- 在本地进行更改(通常只需几行)
- rsync 到登台服务器
- 在那里进行测试
- 如果不起作用,请转到步骤 1
- 如果有效,则提交、推送并进入睡眠状态
注意:我真的不想提交我的工作:这是几行代码,在登台服务器上测试它之前我根本不知道它是否有意义
我做了我讨厌的第 2 步(rsync 不是那么容易使用 - 时间戳、删除文件、权限等等),因为 git 不允许我在未提交的工作中移动。
我知道我可以准备补丁或捆绑包,但这些都不是正确的解决方案,因为这比 rsync 还要复杂。如果除了patch 或bundle 之外别无选择,我会坚持使用 rsync。
有没有办法像这样轻松地使用 git 来处理未提交的工作?
devel $ git upload # uploads non-committed work to the remote
staging $ git download # downloads non-committed work from the remote
我猜不是,但我不得不问......
注意
git stash 接近我想要的,但 AFAIK 无法推送存储。否则我会:
devel $ git stash
devel $ git push # push the stash stack (not really possible with git)
staging $ git pull # get the stash stack (not really possible with git)
staging $ git stash pop
【问题讨论】:
-
叮咚! Git 不是部署工具。
-
你可以将工作提交到一个单独的分支并推拉它。
-
@hek2mgl: git 是它可以做的任何事情......
-
@jeckyll2hide 你可以用显微镜敲钉子,但使用合适的工具会更容易。但如果你真的想使用 git,那么 google 'git push stash stack'。我相信你可以将 stash 推送到远程
标签: git