美文网首页
git使用笔记

git使用笔记

作者: Little熊猫 | 来源:发表于2018-12-28 10:53 被阅读0次

一 使用git进行代码打包

git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)

Create a tar archive that contains the contents of the latest commit on the current branch, and extract it in the /var/tmp/junk directory.

git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip >git-1.4.0.tar.gz

Create a compressed tarball for v1.4.0 release.

git archive -o latest.zip HEAD

Create a Zip archive that contains the contents of the latest commit on the current branch. Note that the output format is inferred by the extension of the output file.

在git打包中有几点需要注意
export-ignore
Files and directories with the attribute export-ignore won’t be added to archive files. See gitattributes[5] for details.
也就是export-ignore文件不会被打包
export-subst
If the attribute export-subst is set for a file then Git will expand several placeholders when adding this file to an archive. See gitattributes[5] for details.
export-subst的使用规则如下:

$ echo 'Last commit date: $Format:%cd$' > LAST_COMMIT
$ echo "LAST_COMMIT export-subst" >> .gitattributes
$ git add LAST_COMMIT .gitattributes
$ git commit -am 'adding LAST_COMMIT file for archives'

当你使用git archive的时候

$ cat LAST_COMMIT
Last commit date: $Format:Tue Apr 21 08:38:48 2009 -0700$

相关文章

  • Git book

    目录 git community book git入门 git笔记 git 用法 git安装使用手册 git命令大...

  • Git与Git flow使用笔记

    使用Git的一些真实的使用笔记,这不是理论,而是真实的使用过程中的一些笔记 基础Git与流程 git init 初...

  • Git

    Git使用笔记 下载(Window版):https://git-for-windows.github.io/ 安装...

  • Git常用命令

    本文作为平日使用git的笔记 查看文件状态: $ git status //查看文件状态 存储文件: $ git ...

  • Git入门及常用方法

    Git学习笔记 关于 Git 的背景知识 Git 是什么Git——分布式版本控制系统,Linus使用C编写 Git...

  • **git** 使用笔记

    git 使用笔记 git原理: 文件(blob)对象,树(tree)对象,提交(commit)对象 tree对象 ...

  • 2019-10-25

    git 使用笔记 git原理: 文件(blob)对象,树(tree)对象,提交(commit)对象 tree对象 ...

  • Git教程笔记

    笔记20170207:Git教程 初始化一个Git仓库,使用git init命令。 添加文件到Git仓库,分两步:...

  • 2019-07-12

    Git使用笔记 0、先将工作分支的内容提交 git add . git commit -m "说明文字" 1、切换...

  • Git学习笔记(廖雪峰)

    Git学习笔记(廖雪峰) 创建版本库 小结 初始化一个Git仓库,使用git init命令。 添加文件到Git仓库...

网友评论

      本文标题:git使用笔记

      本文链接:https://www.haomeiwen.com/subject/vekslqtx.html