I have made a commit with message "Recycler View in Main Activity". The Head was on it. I switched to a new branch without seeing the warning. I am now unable to see my commit with message "Recycler View in Main Activity". How can I retrieve a commit which is not associated with any branch? Please help I am very new to GitHub.
My Terminal is as follows:
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git add .
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git commit -m "Recycler View in Main Activity"
[detached HEAD 35b478b] Recycler View in Main Activity
5 files changed, 96 insertions(+), 51 deletions(-)
rewrite app/src/main/java/com/example/worldclocktest/CitySelectedListAdapter.java (60%)
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git log
commit 35b478bf8761480eeed417d3fa8ae3bab44cfa36 (HEAD)
Author: Hizafa-Nadeem <hizafa.977@gmail.com>
Date: Thu May 6 04:44:13 2021 +0500
Recycler View in Main Activity
commit 6dfc1a1db723e268d967ebcf34a8dac45f41514b (Recycler-View)
Author: Hizafa-Nadeem <hizafa.977@gmail.com>
Date: Thu May 6 02:40:11 2021 +0500
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git push -u origin Recycler_View
error: src refspec Recycler_View does not match any
error: failed to push some refs to 'https://github.com/Hizafa-Nadeem/WorldClock-App-'
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git push -u origin Recycler-View
Enumerating objects: 115, done.
Counting objects: 100% (115/115), done.
Delta compression using up to 8 threads
Compressing objects: 100% (89/89), done.
Writing objects: 100% (115/115), 139.26 KiB | 1.00 MiB/s, done.
Total 115 (delta 19), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (19/19), done.
remote:
remote: Create a pull request for 'Recycler-View' on GitHub by visiting:
remote: https://github.com/Hizafa-Nadeem/WorldClock-App-/pull/new/Recycler-View
remote:
To https://github.com/Hizafa-Nadeem/WorldClock-App-
* [new branch] Recycler-View -> Recycler-View
Branch 'Recycler-View' set up to track remote branch 'Recycler-View' from 'origin'.
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git checkout cities_declared_in_activity_main
error: pathspec 'cities_declared_in_activity_main' did not match any file(s) known to git
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git checkout cities_declared_in_activitymain
error: pathspec 'cities_declared_in_activitymain' did not match any file(s) known to git
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git log
commit 35b478bf8761480eeed417d3fa8ae3bab44cfa36 (HEAD)
Author: Hizafa-Nadeem <hizafa.977@gmail.com>
Date: Thu May 6 04:44:13 2021 +0500
Recycler View in Main Activity
commit 6dfc1a1db723e268d967ebcf34a8dac45f41514b (origin/Recycler-View, Recycler-View)
Author: Hizafa-Nadeem <hizafa.977@gmail.com>
Date: Thu May 6 02:40:11 2021 +0500
first commit on Recycler View
commit 269b5fee830e7a26a1fabd008f60ff6b236cb111 (cities_declared_in_main_activty)
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git checkout cities_declared_in_main_activty
Warning: you are leaving 1 commit behind, not connected to
any of your branches:
35b478b Recycler View in Main Activity
If you want to keep it by creating a new branch, this may be a good time
to do so with:
git branch <new-branch-name> 35b478b
Switched to branch 'cities_declared_in_main_activty'
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git status
On branch cities_declared_in_main_activty
nothing to commit, working tree clean
C:\Users\Dell\AndroidStudioProjects\WorldClockTest>git push -u origin cities_declared_in_main_activty