$ git rev-parse --git-dir
以下还有几项,不具体翻译了。
- Checking if you’re currently within a repository using --is-inside-git-dir or within a work-tree using --is-inside-work-tree
- Checking if the repo is a bare using --is-bare-repository
- Printing SHA1 hashes of branches (–branches), tags (–tags) and the refs can also be filtered based on the remote (using --remote)
- –parse-opt to normalize arguments in a script (kind of similar to getopt) and print an output string that can be used with eval
Massage just implies that it is possible to convert the info from one form into another i.e. a transformation command. These are some quick examples I can think of:
这里解释了Massage,Massage在这里暗示着有可能会把一个信息的格式转换成另外一种。
- a branch or tag name into the commit’s SHA1 it is pointing to so that it can be passed to a plumbing command which only accepts SHA1 values for the commit.
把一个分支名或者tag名转换成了一个提交的SHA1,要是从这个意义来理解,这个plumbing还真是管道的意思。
- a revision range A…B for git log or git diff into the equivalent arguments for the underlying plumbing command as B ^A
这个命令有点绕,第一天完全没看懂,第二天才初步搞明白一点。
https://git-scm.com/docs/git-rev-parse 官网
https://cloud.tencent.com/developer/section/1138781 这里有点意思,是对上面官网的直接翻译
https://stackoverflow.com/questions/15798862/what-does-git-rev-parse-do 这里讲了一些常见的用法
前言在研究Jenkins的时候,遇到了git rev-parse这个命令,这里学习一下这个命令。正文git-rev-parse - Pick out and massage parameters这是这个命令的概要解释,理解起来有一点障碍,挑选出来并且“按摩”参数,这个有点意思啊,对参数进行一下按摩。(这里这个massage是不是应该按照调整来理解呢?)Many Git porcel...
next-build-id
为您的Next.js应用使用一致的,基于git的构建ID
小型软件包,可在多服务器部署中的每台服务器上运行next build时为您的Next.js应用生成一致的,基于git的构建ID。
该模块导出一个函数,您可以将其用作next.config.js中的 config选项。
默认情况下,它将使用本地git存储库中的最新git commit哈希(等效于git rev-parse HEAD ):
// next.config.js
const nextBuildId = require ( 'next-build-id' )
module . exports = {
generateBuildId : ( ) => nextBuildId ( { dir : __dirname } )
// => 'f9fc968afa249d162c924a8d5b4ce6562c164c2e'
如果您宁愿使用相对于git repo中最新标签的构建ID,请传递describe: true作为选项,而git describe --tags的输出将改为使用:
Backward compatibility note
* The "--base" option of "format-patch" computed the patch-ids for
prerequisite patches in an unstable way, which has been updated to
compute in a way that is compatible with "git patch-id --stable".
* The "git log" command by default behaves as if the --mailmap option
was given.
UI, Workflows & Features
* The "git fast-export/import" pair has been taught to handle commits
with log messages in encoding other than UTF-8 better.
* In recent versions of Git, per-worktree refs are exposed in
refs/worktrees/<wtname>/ hierarchy, which means that worktree names
must be a valid refname component. The code now sanitizes the names
given to worktrees, to make sure these refs are well-formed.
* "git merge" learned "--quit" option that cleans up the in-progress
merge while leaving the working tree and the index still in a mess.
* "git format-patch" learns a configuration to set the default for
its --notes=<ref> option.
* The code to show args with potential typo that cannot be
interpreted as a commit-ish has been improved.
* "git clone --recurse-submodules" learned to set up the submodules
to ignore commit object names recorded in the superproject gitlink
and instead use the commits that happen to be at the tip of the
remote-tracking branches from the get-go, by passing the new
"--remote-submodules" option.
* The pattern "git diff/grep" use to extract funcname and words
boundary for Matlab has been extend to cover Octave, which is more
or less equivalent.
* "git help git" was hard to discover (well, at least for some
people).
* The pattern "git diff/grep" use to extract funcname and words
boundary for Rust has been added.
* "git status" can be told a non-standard default value for the
"--[no-]ahead-behind" option with a new configuration variable
status.aheadBehind.
* "git fetch" and "git pull" reports when a fetch results in
non-fast-forward updates to let the user notice unusual situation.
The commands learned "--no-show-forced-updates" option to disable
this safety feature.
* Two new commands "git switch" and "git restore" are introduced to
split "checking out a branch to work on advancing its history" and
"checking out paths out of the index and/or a tree-ish to work on
advancing the current history" out of the single "git checkout"
command.
* "git branch --list" learned to always output the detached HEAD as
the first item (when the HEAD is detached, of course), regardless
of the locale.
* The conditional inclusion mechanism learned to base the choice on
the branch the HEAD currently is on.
* "git rev-list --objects" learned the "--no-object-names" option to
squelch the path to the object that is used as a grouping hint for
pack-objects.
* A new tag.gpgSign configuration variable turns "git tag -a" into
"git tag -s".
* "git multi-pack-index" learned expire and repack subcommands.
* "git blame" learned to "ignore" commits in the history, whose
effects (as well as their presence) get ignored.
* "git cherry-pick/revert" learned a new "--skip" action.
* The tips of refs from the alternate object store can be used as
starting point for reachability computation now.
* Extra blank lines in "git status" output have been reduced.
* The commits in a repository can be described by multiple
commit-graph files now, which allows the commit-graph files to be
updated incrementally.
* "git range-diff" output has been tweaked for easier identification
of which part of what file the patch shown is about.
Performance, Internal Implementation, Development Support etc.
* Update supporting parts of "git rebase" to remove code that should
no longer be used.
* Developer support to emulate unsatisfied prerequisites in tests to
ensure that the remainder of the tests still succeeds when tests
with prerequisites are skipped.
* "git update-server-info" learned not to rewrite the file with the
same contents.
* The way of specifying the path to find dynamic libraries at runtime
has been simplified. The old default to pass -R/path/to/dir has been
replaced with the new default to pass -Wl,-rpath,/path/to/dir,
which is the more recent GCC uses. Those who need to build with an
old GCC can still use "CC_LD_DYNPATH=-R"
* Prepare use of reachability index in topological walker that works
on a range (A..B).
* A new tutorial targeting specifically aspiring git-core
developers has been added.
* Auto-detect how to tell HP-UX aCC where to use dynamically linked
libraries from at runtime.
* "git mergetool" and its tests now spawn fewer subprocesses.
* Dev support update to help tracing out tests.
* Support to build with MSVC has been updated.
* "git fetch" that grabs from a group of remotes learned to run the
auto-gc only once at the very end.
* A handful of Windows build patches have been upstreamed.
* The code to read state files used by the sequencer machinery for
"git status" has been made more robust against a corrupt or stale
state files.
* "git for-each-ref" with multiple patterns have been optimized.
* The tree-walk API learned to pass an in-core repository
instance throughout more codepaths.
* When one step in multi step cherry-pick or revert is reset or
committed, the command line prompt script failed to notice the
current status, which has been improved.
* Many GIT_TEST_* environment variables control various aspects of
how our tests are run, but a few followed "non-empty is true, empty
or unset is false" while others followed the usual "there are a few
ways to spell true, like yes, on, etc., and also ways to spell
false, like no, off, etc." convention.
* Adjust the dir-iterator API and apply it to the local clone
optimization codepath.
* We have been trying out a few language features outside c89; the
coding guidelines document did not talk about them and instead had
a blanket ban against them.
* A test helper has been introduced to optimize preparation of test
repositories with many simple commits, and a handful of test
scripts have been updated to use it.
Fixes since v2.22
-----------------
* A relative pathname given to "git init --template=<path> <repo>"
ought to be relative to the directory "git init" gets invoked in,
but it instead was made relative to the repository, which has been
corrected.
* "git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.
* The ownership rule for the file descriptor to fast-import remote
backend was mixed up, leading to an unrelated file descriptor getting
closed, which has been fixed.
* A "merge -c" instruction during "git rebase --rebase-merges" should
give the user a chance to edit the log message, even when there is
otherwise no need to create a new merge and replace the existing
one (i.e. fast-forward instead), but did not. Which has been
corrected.
* Code cleanup and futureproof.
* More parameter validation.
* "git update-server-info" used to leave stale packfiles in its
output, which has been corrected.
* The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.
* "git am -i --resolved" segfaulted after trying to see a commit as
if it were a tree, which has been corrected.
* "git bundle verify" needs to see if prerequisite objects exist in
the receiving repository, but the command did not check if we are
in a repository upfront, which has been corrected.
* "git merge --squash" is designed to update the working tree and the
index without creating the commit, and this cannot be countermanded
by adding the "--commit" option; the command now refuses to work
when both options are given.
* The data collected by fsmonitor was not properly written back to
the on-disk index file, breaking t7519 tests occasionally, which
has been corrected.
* Update to Unicode 12.1 width table.
* The command line to invoke a "git cat-file" command from inside
"git p4" was not properly quoted to protect a caret and running a
broken command on Windows, which has been corrected.
* "git request-pull" learned to warn when the ref we ask them to pull
from in the local repository and in the published repository are
different.
* When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.
* "git fetch" into a lazy clone forgot to fetch base objects that are
necessary to complete delta in a thin packfile, which has been
corrected.
* The filter_data used in the list-objects-filter (which manages a
lazily sparse clone repository) did not use the dynamic array API
correctly---'nr' is supposed to point at one past the last element
of the array in use. This has been corrected.
* The description about slashes in gitignore patterns (used to
indicate things like "anchored to this level only" and "only
matches directories") has been revamped.
* The URL decoding code has been updated to avoid going past the end
of the string while parsing %-<hex>-<hex> sequence.
* The list of for-each like macros used by clang-format has been
updated.
* "git branch --list" learned to show branches that are checked out
in other worktrees connected to the same repository prefixed with
'+', similar to the way the currently checked out branch is shown
with '*' in front.
(merge 6e9381469e nb/branch-show-other-worktrees-head later to maint).
* Code restructuring during 2.20 period broke fetching tags via
"import" based transports.
* The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.
* "git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.
* Code clean-up to avoid signed integer wraparounds during binary search.
* "git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.
* "git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.
* "git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.
* An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.
* The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.
* The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.
* Protocol capabilities that go over wire should never be translated,
but it was incorrectly marked for translation, which has been
corrected. The output of protocol capabilities for debugging has
been tweaked a bit.
* Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.
* "git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.
* The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running a non-interactive one, which was not
the case. This has been corrected.
* The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.
* Generation of pack bitmaps are now disabled when .keep files exist,
as these are mutually exclusive features.
(merge 7328482253 ew/repack-with-bitmaps-by-default later to maint).
* "git rm" to resolve a conflicted path leaked an internal message
"needs merge" before actually removing the path, which was
confusing. This has been corrected.
* "git stash --keep-index" did not work correctly on paths that have
been removed, which has been fixed.
(merge b932f6a5e8 tg/stash-keep-index-with-removed-paths later to maint).
* Window 7 update ;-)
* A codepath that reads from GPG for signed object verification read
past the end of allocated buffer, which has been fixed.
* "git clean" silently skipped a path when it cannot lstat() it; now
it gives a warning.
* "git push --atomic" that goes over the transport-helper (namely,
the smart http transport) failed to prevent refs to be pushed when
it can locally tell that one of the ref update will fail without
having to consult the other end, which has been corrected.
* The internal diff machinery can be made to read out of bounds while
looking for --function-context line in a corner case, which has been
corrected.
(merge b777f3fd61 jk/xdiff-clamp-funcname-context-index later to maint).
* Other code cleanup, docfix, build fix, etc.
(merge fbec05c210 cc/test-oidmap later to maint).
(merge 7a06fb038c jk/no-system-includes-in-dot-c later to maint).
(merge 81ed2b405c cb/xdiff-no-system-includes-in-dot-c later to maint).
(merge d61e6ce1dd sg/fsck-config-in-doc later to maint).
const git = require ( 'git-client' ) ;
const hash = await git ( 'rev-parse HEAD' ) ;
const hash = await git ( 'rev-parse' , 'HEAD' ) ;
const hash = await git ( 'rev-parse' , { verify : true , short : 6 } , 'HEAD' ) ;
常用命令的命名方法
const hash = await git . revParse ( { verify : true } , 'HEAD' ) ;
从网络保存文件
const writer = await git . hashObj
[Pipeline] { (Checkout)
[Pipeline] checkout
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origi...
一、准备工作
第一步:在d盘git test目录下,新建工作区根目录demo,进入该目录后,执行git init创建版本库。
DH207891+OuyangPeng@DH207891 MINGW32 /d/git test
$ mkd...
使用jenkins Pipelines 部署项目时, 首次构建成功,再次构建时报错如下:
using credential jenkins-generated-ssh-key
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git c...
1,myroot@myroot:~/linux/linux-5.15.7$ git log
commit ea79e49b21ae8706dfbe5e2f13a766b5b10ac9db (HEAD -> master)
Author: xxxxx
Date: Sat Mar 19 19:29:29 2022 +0800
linux-5.15.7
myroot@myroot:~/linux/linux-5.15.7$ git rev-parse --verify --short HE...
控制台输出
Started by user anonymous
Building in workspace /root/.jenkins/jobs/api/workspace
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git conf
当我们的自动化项目越来越多的时候,在代码仓库会提交不同的分支来管理,在用jenk
ins来构建的时候,我们希望能通过参数化构建
git仓库的分支。
Git Parameter插件
先下载
Git Parameter 插件,系统管理-插件管理-搜索:
Git Parameter 下载安装
参数化构建工程
General-参数化构建过程-添加参数-
Git Parameter,
这个错误提示是由于 Git 在当前目录下找不到有效的 Git 仓库导致的。这通常是因为你在一个非 Git 仓库的目录下执行了 Git 命令。
如果你想在一个 Git 仓库之外使用 Git,你可以尝试指定一个 Git 仓库的路径作为参数。例如,你可以在命令中使用 `-C` 选项来指定 Git 仓库的路径,如下所示:
git -C /path/to/git/repository <command>
在你的例子中,你可以尝试在 `Supermarket_system` 目录之外执行 Git 命令时,使用 `-C` 选项并指定 Git 仓库的路径。例如,你可以尝试以下命令:
git -C /path/to/git/repository rev-parse --git-dir
请将 `/path/to/git/repository` 替换为你实际的 Git 仓库路径。