Git commitments have disappeared.

Asked 2 years ago, Updated 2 years ago, 54 views

The contents committed in Git disappeared.I created a new branch (branch-3) from the GitHub browser console.

Corrected branch-3 locally.

%git branch
* (HEAD detected from origin/branch-3)
branch-1
branch-2

When I tried to git push, I received an error similar to the following:

%git push origin HEAD

error:The destination you provided is not a full refname(i.e.,
starting with "refs/").Wetried to guide what you want by:

- Looking for a ref that matches 'HEAD' on the remote side.
- Checking if the <src>being pushed ('HEAD')
is a ref in "refs/{heads, tags}/".If so add a corresponding
refs / {heads, tags} / prefix on the remote side.

Neither worked, so give up. You must fully qualify the ref.
hint —The<src>part of the refspec is a commit object.
hint —Did you mean to create a new branch by pushing to
hint: 'HEAD:refs/heads/HEAD'?

I'm not sure

$git checkout branch-3

Then it ended up being an omit.
Is it no longer possible to restore it?

$git branch-a
* (HEAD detected at origin/branch-3)
branch-1
branch-2
branch-3
master
remotes/origin/branch-1
remotes/origin/branch-2
$git reflog
3676487 (HEAD->branch-3, origin/master, origin/branch-3) HEAD@{0}:checkout:moving from 367648702311ad0e5f0451b582fd895b68b9d07 to branch-3
3676487 (HEAD->issue-7, origin/master, origin/branch-3) HEAD@{1}:checkout:moving from issue-7 to origin/branch-3
3676487 (HEAD->issue-7, origin/master, origin/issue-3) HEAD@{2}:checkout:moving from 34345434440ec0daba27f694ce92ffb93a410f to branch-3
4049480HEAD@{3}:commit:VERY IMPORTANT MODIFY.

git

2022-09-30 19:39

1 Answers

(Perhaps the information provided is not accurate…)

Is 4049480 what you want to restore?(git show 4049480 or git log-p 4049480)

push changes to branch-3 with the following command:

 git push origin 4049480: branch-3

Even if push is not 4049480, I think you can take commit from the git reflog result (so you can push with that hash value).


2022-09-30 19:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.