推送远程仓库导致本地提交记录消失,如何找回 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
HaibaraDP
V2EX    git

推送远程仓库导致本地提交记录消失,如何找回

  •  
  •   HaibaraDP 208 天前 2127 次点击
    这是一个创建于 208 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码提交到了本地仓库,使用 github desktop 的 add local repository 添加本地仓库,点击 pulish repository ,设置仓库名以及可见性都没问题,但推送代码发现无法点击,发现分支可以切换(但我本地只有一个分支),切换后推送上去了,此时再打开 vscode ,就发现本地仓库最近一周的提交记录都没了,github 上也没有,怎么找回呢?

    5 条回复    2025-03-18 18:08:38 +08:00
    HaibaraDP
        1
    HaibaraDP  
    OP
       208 天前
    2025-03-17T14:56:56.606Z - info: [main] Using toast activator CLSID {27D44D0C-A542-5B90-BCDB-AC3126048BA2}
    2025-03-17T14:56:57.124Z - info: [ui] [AppStore] loading 14 repositories from store
    2025-03-17T14:56:57.125Z - info: [ui] [AppStore] found account: mygithubname (mygithubname)
    2025-03-17T14:56:57.969Z - info: [ui] [AppStore] removing account mygithubname (mygithubname) from store
    2025-03-17T14:56:57.969Z - warn: [ui] fetchAll: 'repos/mygithubname/y/issues?state=open' returned a 401
    2025-03-17T14:56:57.975Z - warn: [ui] Alive web socket request failed: Error: Bad credentials
    2025-03-17T14:56:58.396Z - error: [ui] Could not get Alive web socket URL for 'mygithubname'
    Error: Bad credentials
    at cn (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\http.ts:178:11)
    at Xn.getAliveWebSocketURL (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\api.ts:848:16)
    at Object.createSessionForAccount (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:170:7)
    at Object.subscribeToAccount (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:227:11)
    at Object._subscribeToAccounts (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:146:37)
    2025-03-17T14:56:58.396Z - info: [ui] [fetchProtectedBranches] unable to list protected branches
    Error: Bad credentials
    at cn (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\http.ts:178:11)
    at Xn.fetchProtectedBranches (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\api.ts:1619:7)
    at Za.updateBranchProtectionsFromAPI (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\app-store.ts:4123:11)
    2025-03-17T14:56:58.397Z - warn: [ui] fetchMentionables: failed for mygithubname/s
    Error: Bad credentials
    at cn (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\http.ts:178:11)
    at Xn.fetchMentionables (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\api.ts:1824:16)
    at mN.constructor.updateMentionables (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\github-user-store.ts:90:11)
    2025-03-17T14:56:58.607Z - info: [ui] launching: 3.3.6 (Windows 10.0.26100)
    2025-03-17T14:56:58.616Z - info: [ui] execPath: 'C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\GitHubDesktop.exe'
    2025-03-17T14:56:59.213Z - info: [ui] Executing getRemotes: git remote -v (took 1.093s)
    2025-03-17T14:56:59.214Z - info: [ui] Executing getRemotes: git remote -v (took 1.833s)
    2025-03-17T14:56:59.234Z - warn: [ui] Alive channel request failed: Error: Bad credentials
    2025-03-17T14:57:00.352Z - warn: [ui] Alive web socket request failed: Error: Bad credentials
    2025-03-17T14:57:00.352Z - error: [ui] Could not get Alive web socket URL for 'mygithubname'
    Error: Bad credentials
    at cn (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\http.ts:178:11)
    at Xn.getAliveWebSocketURL (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\api.ts:848:16)
    at Object.createSessionForAccount (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:170:7)
    at Object.subscribeToAccount (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:227:11)
    at Object._subscribeToAccounts (C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\webpack:\app\src\lib\stores\alive-store.ts:146:37)
    2025-03-17T14:57:00.352Z - info: [ui] Stats reported.
    2025-03-17T14:57:00.732Z - info: [ui] Executing installGlobalLFSFilter: git lfs install --skip-repo (took 2.151s)
    2025-03-17T14:57:00.743Z - warn: [ui] Alive channel request failed: Error: Bad credentials
    2025-03-17T14:57:02.157Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.824s)
    2025-03-17T14:57:03.739Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.581s)
    2025-03-17T14:57:05.935Z - info: [ui] [SignInStore] initializing OAuth flow
    2025-03-17T14:57:05.936Z - info: [main] opening in browser: https://github.com/login/oauth/authorize?0
    2025-03-17T14:57:39.593Z - info: [main] Received possible protocol arguments: 4
    2025-03-17T14:57:39.595Z - info: [main] Processing protocol url
    2025-03-17T14:57:39.597Z - info: [ui] [Dispatcher] requesting authenticated user
    2025-03-17T14:57:39.707Z - info: [main] Received possible protocol arguments: 3
    2025-03-17T14:57:41.091Z - info: [ui] Executing getSymbolicRef: gitsymbolic-ref -q refs/remotes/origin/HEAD (took 40.737s)
    2025-03-17T14:57:42.148Z - info: [ui] [SignInStore] account resolved
    2025-03-17T14:57:42.148Z - info: [ui] [AppStore] adding account mygithubname (mygithubname) to store
    2025-03-17T14:57:43.060Z - info: [ui] Subscribed 'mygithubname' to Alive channel
    2025-03-17T14:58:07.087Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: r - mygithubname (has token)
    2025-03-17T14:58:07.166Z - info: [ui] [AppStore] adding repository at D:\Code\not_found_product to store
    2025-03-17T14:58:08.688Z - info: [ui] Executing isUsingLFS: git lfs track (took 1.256s)
    2025-03-17T14:58:09.447Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.357s)
    2025-03-17T14:58:10.921Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.472s)
    2025-03-17T14:58:13.400Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: l - mygithubname (has token)
    2025-03-17T14:58:16.837Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 3.431s)
    2025-03-17T14:58:18.257Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.419s)
    2025-03-17T14:58:19.981Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: j - mygithubname (has token)
    2025-03-17T14:58:23.191Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 3.206s)
    2025-03-17T14:58:27.755Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 4.559s)
    2025-03-17T14:58:33.514Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository:s - mygithubname (has token)
    2025-03-17T14:58:55.046Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 21.527s)
    2025-03-17T14:58:56.835Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.783s)
    2025-03-17T14:59:20.012Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: v - mygithubname (has token)
    2025-03-17T14:59:22.401Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.387s)
    2025-03-17T14:59:24.005Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.603s)
    2025-03-17T14:59:26.258Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: q - mygithubname (has token)
    2025-03-17T14:59:40.294Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 14.031s)
    2025-03-17T14:59:42.566Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 2.266s)
    2025-03-17T14:59:43.979Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: c - mygithubname (has token)
    2025-03-17T14:59:47.600Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 3.617s)
    2025-03-17T14:59:49.307Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.706s)
    2025-03-17T14:59:52.257Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: t - mygithubname (has token)
    2025-03-17T14:59:55.351Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 3.090s)
    2025-03-17T14:59:56.893Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.541s)
    2025-03-17T14:59:57.094Z - info: [ui] [RepositoryIndicatorUpdater]: Refreshing sidebar indicators for 14 repositories took 91.4s of which 21.3s paused, total 112.7s
    2025-03-17T15:00:45.248Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: not_found_product - mygithubname (has token)
    2025-03-17T15:00:48.208Z - info: [ui] [Timing] Action 'checkout branch from list' for 'mygithubname/not_found_product' took 2.960s
    2025-03-17T15:00:54.653Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: not_found_product - mygithubname (has token)
    2025-03-17T15:01:00.699Z - info: [ui] Executing push: git -c credential.helper= push origin master --set-upstream --progress (took 6.025s)
    2025-03-17T15:01:03.029Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.327s)
    2025-03-17T15:01:04.956Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.926s)
    2025-03-17T15:01:16.206Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: not_found_product - mygithubname (has token)
    HaibaraDP
        2
    HaibaraDP  
    OP
       208 天前
    2025-03-17T15:01:18.755Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.539s)
    2025-03-17T15:01:20.720Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.964s)
    2025-03-17T15:04:34.078Z - info: [main] Using toast activator CLSID {}
    2025-03-17T15:04:34.540Z - info: [ui] [AppStore] loading 15 repositories from store
    2025-03-17T15:04:34.541Z - info: [ui] [AppStore] found account: mygithubname (mygithubname)
    2025-03-17T15:04:34.554Z - info: [ui] [BranchPruner] Last prune took place 5 minutes ago - skipping
    2025-03-17T15:04:35.074Z - info: [ui] launching: 3.3.6 (Windows 10.0.26100)
    2025-03-17T15:04:35.075Z - info: [ui] execPath: 'C:\Users\mywindowsname\AppData\Local\GitHubDesktop\app-3.3.6\GitHubDesktop.exe'
    2025-03-17T15:04:35.673Z - info: [ui] Subscribed 'mygithubname' to Alive channel
    2025-03-17T15:07:31.876Z - info: [ui] [Timing] Action 'checkout branch from list' for 'mygithubname/not_found_product' took 0.000s
    2025-03-17T15:11:17.909Z - info: [ui] [RepositoryIndicatorUpdater]: Refreshing sidebar indicators for 14 repositories took 17.3s of which 216.9s paused, total 234.2s
    2025-03-17T15:19:35.193Z - info: [ui] [AppStore] adding repository at D:\Code\ad to store
    2025-03-17T15:19:36.599Z - info: [ui] Executing isUsingLFS: git lfs track (took 1.162s)
    2025-03-17T15:22:37.670Z - info: [ui] Executing push: git -c credential.helper= push origin main --set-upstream --progress (took 2.933s)
    2025-03-17T15:22:39.760Z - info: [ui] Executing fetch: git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin (took 2.084s)
    2025-03-17T15:22:41.708Z - info: [ui] Executing updateRemoteHEAD: git -c credential.helper= remote set-head -a origin (took 1.942s)
    2025-03-17T15:40:24.559Z - info: [ui] [RepositoryIndicatorUpdater]: Refreshing sidebar indicators for 15 repositories took 14.5s of which 1041.6s paused, total 1056.1s
    2025-03-17T15:43:18.225Z - info: [ui] [RepositoryIndicatorUpdater]: Refreshing sidebar indicators for 15 repositories took 14.0s of which 0.0s paused, total 14.0s

    上面是 github desktop 的日志
    HaibaraDP
        3
    HaibaraDP  
    OP
       208 天前
    感谢 grok3 ,通过 git reflog --date=iso 找到了
    prosgtsr
        4
    prosgtsr  
       207 天前
    我唯一一条记住的命令就是 git reflog 。。。其他操作全用 idea
    hexiaowu1993
        5
    hexiaowu1993  
       207 天前
    本地只要 commit 过,都可以通过 git reflog 找回来
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     863 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 22ms UTC 21:47 PVG 05:47 LAX 14:47 JFK 17:47
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86