git 推送 - 我的提交哈希在哪里 - git 日志未显示在历史 MIRROR 存储库中
git push - where's my commit hash - git log is not showing in the history MIRROR repository
我从 GIT 存储库(最新)克隆。此时,存储库中的最新提交是:a10cb09
我在我的小包装脚本中使用以下命令(我在其中设置变量 r
= 传递的第一个参数(对于 repo 名称又名 ansible
)进行克隆:
git clone git@github.com:mycompany/${r}.git
并进行了一些更改并执行了以下简单步骤:(即进行更改、添加 file/folder、提交并推送)我得到了一个新的提交哈希 a08c263
(简称)。
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
roles/mycompany.mycompany-ansible/
mycompany-ansible.yml
nothing added to commit but untracked files present (use "git add" to track)
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git add mycompany-ansible.yml roles/mycompany.mycompany-ansible
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git commit -m "mycompany.mycompany-ansible playbook and role" mycompany-ansible.yml roles/mycompany.mycompany-ansible
[master a08c263] mycompany.mycompany-ansible playbook and role
14 files changed, 1771 insertions(+)
create mode 100644 roles/mycompany.mycompany-ansible/README.md
create mode 100644 roles/mycompany.mycompany-ansible/defaults/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/handlers/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/meta/.galaxy_install_info
create mode 100644 roles/mycompany.mycompany-ansible/meta/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/apt_install.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/yum_install.yml
create mode 100644 roles/mycompany.mycompany-ansible/templates/10-statsd.conf.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/10-mycompany.conf.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/proxy_auth_credentials.set.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/telegraf.conf.wfcopy.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/mycompany-proxy.conf.j2
create mode 100644 mycompany-ansible.yml
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git push
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 18.65 KiB | 0 bytes/s, done.
Total 21 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:repogroup/ansible.git
a10cb09..a08c263 master -> master
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git log -1 --pretty=format:%h
a10cb09
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git rev-parse a08c263
a08c263
fatal: ambiguous argument 'a08c263': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
当我去 Github 仓库查看我的最新更改时,它不在那里。 git log
也没有显示我的提交(相反,它显示了我提交之前位于顶部的提交哈希)。我错过了什么?
似乎我什至无法使用 git rev-parse a08c263
(小哈希)看到长哈希。
$ git remote -v
origin git@github.com:mycompany/ansible.git (fetch)
origin git@github.com:mycompany/ansible.git (push)
和
$ git reflog
a10cb09 HEAD@{0}: clone: from git@github.com:mycompany/ansible.git
PS:如果我对 mycompany
存储库组下的其他存储库执行相同的步骤,所有这些存储库都会得到我的 commit/push如果我按照类似的步骤,在 github 中更改成功。
更新: 我的一个浏览器页面仍处于打开状态。在我提交+推送之后,我能够看到我提交的更改(新哈希 a08c263
作为顶级回购级别的最新提交)。当我点击它时,它打开了这个附加的浏览器页面,我可以在其中看到完整的哈希以及 folder/files。如果我访问打开的浏览器 URL 我的提交,它仍然存在(所以 Git 确实保存了一些东西)但是点击存储库的根级别,即 ansible
,最新的提交不是我的commit+push(新散列)但它列出 a10cb09
作为最新的(根据快照是我新生成的散列的父散列)。看这里:
现在提出主要问题:
如果我没有打开这个浏览器页面,那么我怎么会得到长散列和我的 folder/files(内容)?
如果我从 github.com/mycompany/ansible (repo) 克隆,它是 ansible 存储库的镜像,实际上托管在 Phabricator 中(实际原始存储库克隆 URL 与我在上面的小脚本中使用的不同),那么我应该使用什么命令/选项将我的新更改推送到原始 Phabricator ansible
存储库?
如果提交+推送在我这边完成,为什么 git log
和其他类似的 git
命令没有显示任何关于我的新哈希的信息?
Visiting that link still works, shows me the files/folders that I committed, but if I click on the root repository in Github, it doesn't show my commit as latest
这意味着:
- 远程仓库默认分支不是master
- 或一些挂钩(post-接收?)将 HEAD 设置或重置为不同的 SHA1
this ansible repo that I cloned, is NOT HOSTED on github.com. ansible repo in my case is hosted in Phabricator and MIRRORED to Github.com (from where I cloned) it
这可以解释重置。
The biggest worry is how can I get my folder/files from that a08c263 commit back to my workspace. git log or git rev-parse is not showing anything / throwing an error, as that hash doesn't exist as per Git.
当然:从另一个本地文件夹中的 github 克隆,将您之前的克隆文件夹添加为远程仓库,获取并挑选您的提交:
git clone https://github.com/... newfolder
cd newfolder
git remote add old ../path/to/first/clone
git fetch old
git cherry-pick a08c263
git push
但您需要确保您有权退回 GitHub 存储库。
我从 GIT 存储库(最新)克隆。此时,存储库中的最新提交是:a10cb09
我在我的小包装脚本中使用以下命令(我在其中设置变量 r
= 传递的第一个参数(对于 repo 名称又名 ansible
)进行克隆:
git clone git@github.com:mycompany/${r}.git
并进行了一些更改并执行了以下简单步骤:(即进行更改、添加 file/folder、提交并推送)我得到了一个新的提交哈希 a08c263
(简称)。
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
roles/mycompany.mycompany-ansible/
mycompany-ansible.yml
nothing added to commit but untracked files present (use "git add" to track)
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git add mycompany-ansible.yml roles/mycompany.mycompany-ansible
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git commit -m "mycompany.mycompany-ansible playbook and role" mycompany-ansible.yml roles/mycompany.mycompany-ansible
[master a08c263] mycompany.mycompany-ansible playbook and role
14 files changed, 1771 insertions(+)
create mode 100644 roles/mycompany.mycompany-ansible/README.md
create mode 100644 roles/mycompany.mycompany-ansible/defaults/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/handlers/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/meta/.galaxy_install_info
create mode 100644 roles/mycompany.mycompany-ansible/meta/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/apt_install.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/main.yml
create mode 100644 roles/mycompany.mycompany-ansible/tasks/yum_install.yml
create mode 100644 roles/mycompany.mycompany-ansible/templates/10-statsd.conf.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/10-mycompany.conf.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/proxy_auth_credentials.set.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/telegraf.conf.wfcopy.j2
create mode 100644 roles/mycompany.mycompany-ansible/templates/mycompany-proxy.conf.j2
create mode 100644 mycompany-ansible.yml
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git push
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 18.65 KiB | 0 bytes/s, done.
Total 21 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:repogroup/ansible.git
a10cb09..a08c263 master -> master
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git log -1 --pretty=format:%h
a10cb09
[arun@ip-10.20.30.33 ~/aks/always-latest-ws-repogroup/ansible] $ git rev-parse a08c263
a08c263
fatal: ambiguous argument 'a08c263': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
当我去 Github 仓库查看我的最新更改时,它不在那里。 git log
也没有显示我的提交(相反,它显示了我提交之前位于顶部的提交哈希)。我错过了什么?
似乎我什至无法使用 git rev-parse a08c263
(小哈希)看到长哈希。
$ git remote -v
origin git@github.com:mycompany/ansible.git (fetch)
origin git@github.com:mycompany/ansible.git (push)
和
$ git reflog
a10cb09 HEAD@{0}: clone: from git@github.com:mycompany/ansible.git
PS:如果我对 mycompany
存储库组下的其他存储库执行相同的步骤,所有这些存储库都会得到我的 commit/push如果我按照类似的步骤,在 github 中更改成功。
更新: 我的一个浏览器页面仍处于打开状态。在我提交+推送之后,我能够看到我提交的更改(新哈希 a08c263
作为顶级回购级别的最新提交)。当我点击它时,它打开了这个附加的浏览器页面,我可以在其中看到完整的哈希以及 folder/files。如果我访问打开的浏览器 URL 我的提交,它仍然存在(所以 Git 确实保存了一些东西)但是点击存储库的根级别,即 ansible
,最新的提交不是我的commit+push(新散列)但它列出 a10cb09
作为最新的(根据快照是我新生成的散列的父散列)。看这里:
现在提出主要问题:
如果我没有打开这个浏览器页面,那么我怎么会得到长散列和我的 folder/files(内容)?
如果我从 github.com/mycompany/ansible (repo) 克隆,它是 ansible 存储库的镜像,实际上托管在 Phabricator 中(实际原始存储库克隆 URL 与我在上面的小脚本中使用的不同),那么我应该使用什么命令/选项将我的新更改推送到原始 Phabricator
ansible
存储库?如果提交+推送在我这边完成,为什么
git log
和其他类似的git
命令没有显示任何关于我的新哈希的信息?
Visiting that link still works, shows me the files/folders that I committed, but if I click on the root repository in Github, it doesn't show my commit as latest
这意味着:
- 远程仓库默认分支不是master
- 或一些挂钩(post-接收?)将 HEAD 设置或重置为不同的 SHA1
this ansible repo that I cloned, is NOT HOSTED on github.com. ansible repo in my case is hosted in Phabricator and MIRRORED to Github.com (from where I cloned) it
这可以解释重置。
The biggest worry is how can I get my folder/files from that a08c263 commit back to my workspace. git log or git rev-parse is not showing anything / throwing an error, as that hash doesn't exist as per Git.
当然:从另一个本地文件夹中的 github 克隆,将您之前的克隆文件夹添加为远程仓库,获取并挑选您的提交:
git clone https://github.com/... newfolder
cd newfolder
git remote add old ../path/to/first/clone
git fetch old
git cherry-pick a08c263
git push
但您需要确保您有权退回 GitHub 存储库。