相关疑难解决方法(0)

如何在github repo中的文件夹/目录中获取上次提交日期?

例如:我想在这里获得最后提交日期 - https://github.com/elasticsearch/elasticsearch/tree/master/dev-tools/pmd

有了这个,我可以进入 pmd 文件夹 - https://api.github.com/repos/elasticsearch/elasticsearch/contents/dev-tools/pmd

但这没有关于日期的任何数据。我试过了https://api.github.com/repos/elasticsearch/elasticsearch/contents/dev-tools/pmd/commits,这会返回“未找到”消息。

使用 sha 尝试了 git url -https://api.github.com/repos/elasticsearch/elasticsearch/git/blobs/58788337ae94dbeaac72a0901d778a629460c992但即使这样也不会返回任何有用的信息。

如何使用github-api获取文件夹内的提交日期?

git github github-api

6
推荐指数
1
解决办法
3530
查看次数

Git 作者名字后带有星号

PersonA 进行提交,PersonB 的名称带有星号,显示在 IntelliJ IDEA版本控制选项卡的提交历史记录中。

为什么提交用户名改变了?

在此输入图像描述

git intellij-idea

6
推荐指数
1
解决办法
1541
查看次数

如何在没有配置的情况下使用 git 应用补丁

我写了一些使用 git 应用补丁的说明。这些说明旨在放入控制台并完成。像这样:

git am bar.patch
git am foo.patch
Run Code Online (Sandbox Code Playgroud)

但是 git 现在要求用户名/电子邮件:

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@user-VirtualBox.(none)')
You need to set your committer info first
Run Code Online (Sandbox Code Playgroud)

这似乎不是必需的,因为只有补丁的作者出现在 git 日志中,而不是应用补丁的人。有没有办法忽略配置?

编辑:错别字

git configuration patch

5
推荐指数
1
解决办法
578
查看次数

如何在git中保留以前的提交者名称?

为了清理我们的代码,我们想使用 astyle。问题是我们希望有人来完成这项工作,但责怪以前的提交者(代码的真正作者,而不是清理的人)。

有没有办法在 git 中安全地做到这一点?

git blame git-blame

5
推荐指数
1
解决办法
648
查看次数

合并后 Git 显示错误的作者

我很困惑地看到我的同事 Alice 在 git 日志中进行了合并提交,Bob 向我保证确实是他进行了合并。我没有看到鲍勃的其他合并提交,所以看起来爱丽丝以某种方式设法接管了鲍勃的提交。

Alice 确实也提交了一些东西,但她的提交活动很可能是在 Bob 之后的。Alice 仅通过 Visual Studio 的 git ui 使用 git。

我知道可以通过变基操作重写本地提交,但据我了解,通常不会对已推送的提交执行此操作。我认为图形化的 git ui 不会做任何不寻常的事情。

那么为什么我在 git 日志中看到 Alice 是作者和提交者呢?可能发生了什么原因导致这种情况?

编辑:其他提交有明智的作者,所以这不仅仅是配置了错误的用户名。

git

5
推荐指数
1
解决办法
918
查看次数

如何"切换"git-log的日期格式?如何在同一个git日志中同时显示相对和绝对日期?

我当前的默认git日志行运行如下:

git log --graph --date=relative --pretty=format:'%Cblue%h%Creset %Cgreen(%cr)%Creset -%C(yellow)%d%Creset %s' --abbrev-commit -7
Run Code Online (Sandbox Code Playgroud)

然而,有时候,我更喜欢绝对的日期/时间格式,而不是相对格式,所以我尝试了:--date=default--date=local不是--date=relative甚至--date=..完全省略:结果没有改变.可能它与"log.date配置变量设置log命令的--date选项的默认值有关." , 我不知道.可能我需要重新启动终端(但如果是这种情况我会有点失望......).

简而言之,我想"切换"日期,甚至可以在一个git log实例中使用这两种日期格式.

git date git-log

4
推荐指数
1
解决办法
1711
查看次数

git标签有作者和提交者吗?

相关问题 - Git中作者和提交者之间的区别?

我很好奇git中的轻量级标签是否同时提交了提交者和作者(以及提交者日期和作者日期).

注释标签怎么样,它们在这方面有什么不同?

git

4
推荐指数
1
解决办法
549
查看次数

在GitHub提交响应中,作者和提交者之间有什么区别?

[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "commit": {
      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "author": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "committer": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "message": "Fix all the bugs",
      "tree": {
        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
      }
    },
    "author": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    }, …
Run Code Online (Sandbox Code Playgroud)

git github github-api

3
推荐指数
1
解决办法
577
查看次数

Git:如何以其他人的身份提交?

我正在做一个自由职业项目。客户(让我们称他为foob​​ar)要求我使用他的 github 帐户(我的工作 PC 运行 64 位 Windows 10,我安装了 git 2.15.0)上传代码。

所以我做了这些步骤。

  1. 转到凭据管理器 -> Windows 凭据 -> 通用凭据。删除了我的 Github 帐户

  2. 在源代码目录上,执行标准程序:

    git init
    git add *
    git commit -m "first message"
    git remote add origin https://github.com/foobar/supersecretproject.git
    git push -u origin master
    
    Run Code Online (Sandbox Code Playgroud)

出现了一个 Github 凭据对话框。输入了他的证件。

稍等片刻,是的,代码已提交到 Github。打开 Github 页面,奇怪的是提交者是我,而不是foob​​ar。奇怪的。如何解决这个问题?我想以foob​​ar 的身份提交。

git github

2
推荐指数
2
解决办法
2549
查看次数