English 中文(简体)
存放处的地质档案和未经批准的变化
原标题:Git archive of repository with uncommitted changes
  • 时间:2010-05-04 15:21:42
  •  标签:
  • git

我如何利用<条码>git 档案建立现有存放处的档案库,包括当地未经许可的变化?

最佳回答

我知道这一点是老的,但我认为我找到了解决办法。

页: 1

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

由于盖特人希望作出可靠的承诺来提供档案,我们可以使用<代码>git sash作出一项承诺。 <create的指令只是制造了 st子(do你的工作指南或将其推向ash子)并归还给它。

如果你担心从干ling中产生的空间,你可以将其清理成<条码>git gc-prune=now<>。 否则,仅仅等待2周,就消失了。

问题回答

• 为我的目的改进Nevsan的回答——在任何案件中存档最新代码(已提交或未提交):

uploadStash=`git stash create`; git archive -o code_outgoing.zip ${uploadStash:-HEAD}

另一种解决办法是git ls-files:

git ls-files -z | xargs -0 tar -czvf archive.tar.gz

您不必再使用<条码>gitpinash,以制造一种人工承诺,其中包括你经过跟踪的改动,用于<条码>gitarch的运行。

参考文献目录

See commit df368fa, commit 2947a79, commit 200589a (19 Sep 2020) by René Scharfe (rscharfe).
(Merged by Junio C Hamano -- gitster -- in commit f6b06b4, 05 Oct 2020)

archive: add --add-file

Allow users to append non-tracked files.
This simplifies the generation of source packages with a few extra files, e.g. containing version information.
They get the same access times and user information as tracked files.

rel=“nofollow noreferer”>man page :

--add-file=<file>

Add a non-tracked file to the archive.
Can be repeated to add multiple files.
The path of the file in the archive is built by concatenating the value for --prefix (if any) and the basename of <file>.


我也喜欢,Git 2.30 Alternative to tar


在Giteb.37(Q3 2022)之前,“>>(hrgt=git-docs/folmarchive

See commit 6a61661 (12 May 2022) by Junio C Hamano (gitster).
(Merged by Junio C Hamano -- gitster -- in commit 6cd6906, 23 May 2022)

archive: do not let on-disk mode leak to zip archives

When the "--add-file" option is used to add the contents from an untracked file to the archive, the permission mode bits for these files are sent to the archive-backend specific "write_entry()" method as-is.
We normalize the mode bits for tracked files way before we pass them to the write_entry() method; we should do the same here.

tar”存档备份并不严格需要,因为它有自己的代码进一步清理这些编号,但“zip”存档备份尚未做好充分准备。

这创建了一个zi木档案,其中载有所有树木的树木档案,但被 g弃者除外:

git ls-files --others --exclude-standard --cached  | zip --names-stdin archive.zip

如果你不作改动,那么<代码>gitarch就获得帮助。 如果你只是想照一下你的工作领域,tar<>/code>或许是你的最佳之子。

Im利用这一指挥系统向现在出口特定版本(包括不寻常的变更档案)

git archive -o /path/to/save/temp.zip $(git stash create) $(git diff --name-only xxx_version_to_start)

<代码>git ls-files是首选的,因此没有必要制造任何物体。

git ls-files --recurse-submodules -z | tar --null -T - -czvf output.tar.gz
# git ls-files
#   --recurse-submocules
#   -z, split output lines with null
# tar
#  -T -, read files from stdin




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签