git-plumbing

Git Directory Permissions Always 000

陌路散爱 提交于 2020-01-25 06:21:05
问题 By messing around with Git objects, I've found that the tree entries within a tree object always have these permissions. 040000 DirEntry hash The 04 means that it is a directory, but the permissions are 000. Does this mean that Git does not store tree permissions, or is that how Unix works? 回答1: Yeah. Git does not store permissions for tree objects, even though directories Unix filesystems do have them. For files, git only stores the executable bit (+x). All files are assumed to be readable

How can I recover HEAD^'S tree?

情到浓时终转凉″ 提交于 2020-01-01 10:15:10
问题 tl;dr: is it possible to recover HEAD^ 's tree if it is deleted and not pushed beforehand and if everything else is intact? I accidentally deleted part of my .git . I'm not entirely sure what's missing. Upon discovering that git push didn't work, I ran a git fsck : Checking object directories: 100% (256/256), done. Checking objects: 100% (1265/1265), done. broken link from commit f3419f630546ba02baf43f4ca760b02c0f4a0e6d to tree 29616dfefd2bff59b7fb3177e99b4a1efc7132fa broken link from commit

Get a list of changed files and their status for a specific Git commit

筅森魡賤 提交于 2019-12-23 10:25:36
问题 I use the following Git command git diff-tree --no-commit-id --name-only -r <SHA> to get a list of changed files. Unfortunately, the list doesn't specify the type of change for each file: added, modified or deleted ... etc How may I display a list of changes [type of change, file name] in a given SHA of a specific commit. 回答1: Use --name-status instead of --name-only git diff-tree --no-commit-id --name-status -r <SHA> This will show the filename with a status letter of (extracted from man):

Expand git's autocomplete feature to plumbing commands

大憨熊 提交于 2019-12-10 10:36:43
问题 As a follow up to this question, I asked myself if it would be possible to tell git to provide it's autocomplete feature (branches etc.) for further commands, in particular plumbing commands like update-ref . Although update-ref provides more flexibility than branch -f , it's quite a hassle to use since you always have to type the full reference name. Which in turn doesn't make me want to use it. Any ideas on this? 回答1: It is possible to enable the plumbing commands but you will need to

Expand git's autocomplete feature to plumbing commands

偶尔善良 提交于 2019-12-06 05:05:56
As a follow up to this question , I asked myself if it would be possible to tell git to provide it's autocomplete feature (branches etc.) for further commands, in particular plumbing commands like update-ref . Although update-ref provides more flexibility than branch -f , it's quite a hassle to use since you always have to type the full reference name. Which in turn doesn't make me want to use it. Any ideas on this? It is possible to enable the plumbing commands but you will need to provide some of the implementation yourself. Find the git-completion.sh script you are using. In my /users

How can I recover HEAD^'S tree?

拈花ヽ惹草 提交于 2019-12-04 07:47:21
tl;dr: is it possible to recover HEAD^ 's tree if it is deleted and not pushed beforehand and if everything else is intact? I accidentally deleted part of my .git . I'm not entirely sure what's missing. Upon discovering that git push didn't work, I ran a git fsck : Checking object directories: 100% (256/256), done. Checking objects: 100% (1265/1265), done. broken link from commit f3419f630546ba02baf43f4ca760b02c0f4a0e6d to tree 29616dfefd2bff59b7fb3177e99b4a1efc7132fa broken link from commit ccfe9502e24d2b5195008005d83155197a2dca25 to tree 0580c3675560cbfd3f989878a9524e35f53f08e9 broken link

Git clone bare repo without blobs

我只是一个虾纸丫 提交于 2019-12-01 11:03:54
On my git repository, I use an algorithm to assign every commit one or more unique version numbers, based on branch names and tags. I want to use this mechanism with another large repository, that I would like to clone without transferring any files. A bare clone helps me to get rid of the working copy of the blobs, but it still downloads them from the server. A shallow clone with --depth 1 skips most blobs, but also skips downloading the metadata for all commits except one. Is there something like git fast-export --no-data which I can use on the client-side to get the graph information

Git clone bare repo without blobs

流过昼夜 提交于 2019-12-01 09:21:13
问题 On my git repository, I use an algorithm to assign every commit one or more unique version numbers, based on branch names and tags. I want to use this mechanism with another large repository, that I would like to clone without transferring any files. A bare clone helps me to get rid of the working copy of the blobs, but it still downloads them from the server. A shallow clone with --depth 1 skips most blobs, but also skips downloading the metadata for all commits except one. Is there

git scripting: How to list all git branches containing a commit

老子叫甜甜 提交于 2019-11-28 12:20:45
I can list all branches containing a certain commit using git branch --list --contains just fine. But as explained in the related question on how to list all branches , this is a porcelain command that should not be used in scripts. The latter question suggests to use the plumbing command git for-each-ref , but that does not support --contains . What is the correct plumbing interface to list all branches that contain a certain commit. jub0bs One possible solution using the plumbing commands git-for-each-ref and git merge-base (the latter suggested by Joachim himself): #!/bin/sh # git

git scripting: How to list all git branches containing a commit

丶灬走出姿态 提交于 2019-11-27 06:56:19
问题 I can list all branches containing a certain commit using git branch --list --contains just fine. But as explained in the related question on how to list all branches, this is a porcelain command that should not be used in scripts. The latter question suggests to use the plumbing command git for-each-ref , but that does not support --contains . What is the correct plumbing interface to list all branches that contain a certain commit. 回答1: One possible solution using the plumbing commands git