Scare of My Life With GIT: I have no branch!

I checked the old hash (commit) and worked on it, checking fun and ignoring warnings that I was not working in the branch. Then I switched to the branch and realized that I did not have the opportunity to return to my orphan checks (fortunately, I still opened the terminal window, so I checked it and branched it).

How can I get GIT to tell me the names of commits that DO NOT belong to the branch? Or just all the commits if this is not possible ...

+6
git branch
source share
3 answers

See this question for a great explanation on how to find the shots you dropped. You can see dangling commits, etc. In the same way.

+2
source share

git reflog display a log of links created as a result of your recent activity. For future use, the git checkout commit puts you in a disconnected head . If you want to base your work on the old commit, you must create a branch from this commit.

 git checkout -b newbranch oldsha1 

or

 git branch newbranch oldsha1 git checkout newbranch 
+8
source share

You can catch them from the reflog, which stores the commits that you checked.

git reflog print the last commits pointed to by HEAD, which is your working copy.

You can also get a list of all the objects in your tree that are not available from your current branches using git fsck .

+2
source share

All Articles