gpt4 book ai didi

ruby-on-rails - 如何恢复被另一个主站替换的 git 主站

转载 作者:太空狗 更新时间:2023-10-29 14:09:20 24 4
gpt4 key购买 nike

我对自己的 git 存储库做错了 argh :/

在我有 3 个分支之前:master、layout 和 masscreate(全部来 self )。

但是现在,我不知道我做错了什么,我的git master是rails repository的master?!? enter image description here

当我切换到我的主分支并创建 git status 时,它会显示:

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 25732 and 239 different commit(s) each, respectively.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# ... some changes from my own code

我不知道如果我现在提交会发生什么?!

我使用 GitX,它从来没有向我显示 rails 分支。但是现在除了我自己的分支,还有所有的 rails 分支。:/

编辑:

git reflog --all 显示我

a979775 refs/heads/masscreate@{0}: commit: Updated bitcoin client, removed unnecessary files, added mass create feature, updated gems
d2e2fb8 refs/heads/masscreate@{1}: commit: First commit
74fbbca refs/heads/3-1-stable@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: storing head
4a065d5 refs/heads/master@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: forced-update
5419222 refs/heads/layout@{0}: commit: First layout commit - not working
c42120e refs/heads/masscreate@{2}: branch: Created from master
11b0804 refs/heads/layout@{1}: commit: Test commit (with logo)
954297b refs/heads/layout@{2}: branch: Created from master
fd67735 refs/heads/3-0-stable@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: storing head
afd7140 refs/heads/serializers@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: storing head
ba70812 be6527f 7bf12a1 05386ce 471e1f1 7f60202 f40bbc9 57a01f3 162e13d 3c6cbad f8beca0 4f2c238 cf4d166 14e2fe2 fc9b521 aa11f73 9257a21 c6d13b6 d9d1bb2 db8db4a 188d21c 0ad5040 87
633a569 a19ee5c 66c3e31 f9b642c 09ad48f 4f15f39 b45dfc7 3480d97 fb4747b e0c03f8 e0774e4 refs/heads/2-3-stable@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git r
dea5a10 c238ba0 11dafea bb99aa1 2330c0c ae69c4c 29d0ce0 4b4e67f f3f5a8f ebf0cc4 927d3c2 d8c6bab 0c3bdc0 4eac844 dbd72be 282ee95 92d3b51 073d9ff 9e9b127 388f09c 0ab65e8 458128d 35
ad16115 5e61d0b 15e2b58 refs/heads/3-0-9@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: storing head
014008d d2b1340 7b04e50 a7039df 677df61 7f96566 b4b27a3 40dd641 95905c5 1f813d9 055a88d fa55293 f6fe174 b869b8c 71d7610 991e388 6cfd1c7 9267a43 190101e 8624996 5daef25 aeb7beb e5
d846f4b 6766caf e149861 f5f020b b7ea35d f8f00cc 2cbd024 da5122e 296ca01 ea8b05c 54f5fb5 96711aa a995911 654514a 69b25eb 8d758d8 645f138 a2a3413 377b15a b3b747d 1f02e3e 75fb26a f8
79abb70 1c079c5 f0c09f7 99cfdba d387a59 656e7b0 1d864e8 b102e60 d485633 177666e f236dbf 17c9efb c77bdc0 f505565 89252c4 da1ee0e 83f257f 872a9c1 3cbfc8c 5a6927e b648286 d79e284 65
e019587 0acc6bd 92537b8 c6c46e1 280a870 51f5209 af41d55 3b0f917 07fde1a 3e33592 3937296 389d15e 7a152ab 944b4d5 4f04452 9556e9c 9dfc215 49e7555 bb626e7 0675047 d0635b6 b14b058 ce
e9020b4 1c4db4d 18dde7b e6bc818 cb9e501 d907f3c 30264bb d7a5638 a9b4b5d 92e6255 3575782 ac07da8 f323a8f 284ca81 454ec93 b356172 16e5d15 4ac7196 3e24e9e 4c323bc 9bf5cdd bd3cdee a0
ee0b92e 631e23e cd44023 51414a0 1df3b65 9643243 ac86923 ea25224 08ef06d 2b4de66 4f7bdc8 e62b576 d9870d9 52f09ea 05bcb8c d55406d 5f1ea2a 30bba95 1193709 9f773d6 60da34b 933adce 0d
c6cb5a5 refs/heads/2-2-stable@{0}: fetch --force --quiet --tags git://github.com/rails/rails.git refs/heads/*:refs/heads/*: storing head
bcbff10 7a3f05f d152171 c4458b3 8aedd72 b7594a0 f1a15c2 115eedb ef79b91 bf24fe8 3ef6937 52c4755 8f88a28 9d87f41 421e06f 77e1a99 15e7134 3c6c240 100ab5b 1a05125 bbcdc86 a9163b5 d2
f5ed5c3 96183e0 5a898e1 11508db 002985f 25acd19 7963c30 bc821a5 22782e2 3fb493c 01ab6f9 aa508c9 37d7802 c7aea81 11558a1 72545da a2c52f1 43215de 959f857 f07cbec ab1a661 9c53e82 f3
588ac71 0a41ece c6db348 dbe0802 fca617a c40856c 23303d6 017840b a0ca3d1 23f6e51 ea2ad26 92f4cca dd55830 c017041 7ce1539 82a58ab 90176a6 c924068 bee4147 4b21dfe c11ba42 21063e5 22
5bf3294 8a09ea6 7f7480f 3cb5375 aa31a25 bfbdeea c6843e2 7d04a4b a7988fc 75b32a6 070c242 075f8b7 547199e 54250a5 52e526a f6d7a4d 201f373 8cc7463 5360014 227e1ca aeaa468 9e6e648 01
74206ae 774f596 5b1f4c5 ec017e1 5d979de e535b45 3570f3e 3568c5c ddadcc7 5de2e0d 24610c9 08fb1c4 0706bdc 5d7ad7b 22b020d 2de3646 f45714b 8e7a64d a447f76 6949d6f 0428917 6e4e95b 79
095cf91 a32eeeb 38d65b0 fb74a1b 26306f9 896475c 0489f0c 670281c af5b12c e1b1096 2ea1d68 4f37b97 91f65b7 7a48cd6 8a2cfe9 aeab739 47aebac b7c1fbc 1a0f822 314e18a 2ae84e0 c531bd6 ab
21c75e5 cae1d96 db4f421 8bbabd4 f254616 23e58a0 5457770 1a59aa5 4a643f6 25e139e e7ebd65 3025ff2 2920bd2 4e3ecec 1d5ea18 86cb0a6 4ff26f5 191ffc9 3028ca5 f3fd2b1 c55120c 6f0b012 c7

最佳答案

首先,如果您担心丢失任何未提交的工作,请将其保存在其他地方。

git reflog 命令是对当前分支头所做更改的历史记录:

git reflog

将按时间倒序显示(最新的在顶部),每次当前分支头更改为新的提交 id。从此列表中,您可以选择所需的一个,并使用 git reset --hard abc123 将当前分支头重置为该提交。

您可以在 reflog, your safety net 阅读更多关于 reflog 的信息.

关于ruby-on-rails - 如何恢复被另一个主站替换的 git 主站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7934110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com