1. 清空 git 工作区的改动。
$ ~/code/trdp-service$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: aclocal.m4
modified: autogen.sh
modified: compile
modified: config.h.in
modified: configure
modified: depcomp
modified: install-sh
modified: ltmain.sh
modified: m4/libtool.m4
modified: missing
Untracked files:
(use "git add <file>..." to include in what will be committed)
autom4te.cache/
src/.deps/
执行 git clean -df 命令删除当前目录下没有被track过的文件和文件夹,其后再执行 git reset --hard 将改动的文件撤销修改。
$ ~/code/trdp-service$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
2. git打包源代码
git archive --format tar.gz --output "./output.tar.gz" master