存储库的Git存档,具有未提交的更改 [英] Git archive of repository with uncommitted changes

查看:119
本文介绍了存储库的Git存档,具有未提交的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 git archive

推荐答案

我知道这是旧的,但我想我找到了解决方案。

I know this is old, but I think I found a solution.

运行:

stashName=`git stash create`;
git archive <options> $stashName

因为git需要一个可靠的提交来存档,所以我们可以做一个'一次性'使用 git存储提交。 create 命令只是创建隐藏提交(不会重置您的工作目录或将其推送到隐藏栈)并返回它的散列。

Since git wants a solid commit to make an archive, we can make a 'one off' commit using git stash. The create command just creates the stash commit (doesn't reset your working directory or push it to the stash stack) and returns the hash for it.

如果您担心悬挂提交的空间不足,您可以使用 git gc --prune = now 来清理它。否则,只需等待2周,它就会消失。

If you are worried about the space from the dangling commit, you can clean it up with a git gc --prune=now. Otherwise, just wait 2 weeks and it'll disappear.

这篇关于存储库的Git存档,具有未提交的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆