I did:
From branch master
git checkout 09b17a7eebd4
made changes assuming working on master branch
git add
git commit
git push origin master (nothing happened)
git checkout master
git log shows what did on commit 09b17a7eebd4
git pull origin master (Everything up-to date)
I want those changes to reflect to master. Please help fix this issue.
git reflog
09b17a7e (HEAD, origin/master, origin/HEAD, master) HEAD@{0}: checkout: moving from master to 09b17a7eebd465cdd5b13ae30c6e85624da270c5
09b17a7e (HEAD, origin/master, origin/HEAD, master) HEAD@{1}: checkout: moving from 20d355ed7c31f659ef2d44db780f7ce055c594a8 to master
20d355ed HEAD@{2}: commit: partial code cleanup for warnings, removed unused code
09b17a7e (HEAD, origin/master, origin/HEAD, master) HEAD@{3}: checkout: moving from master to 09b17a7eebd465cdd5b13ae30c6e85624da270c5
CodePudding user response:
When you checkout a specific commit, you are entering a detached HEAD
mode. You are no longer in a breach (the commit could belong to many branches after all). As a result, any commit you make is no longer associated with a branch.
Luckily, no commit is lost. You can find any commit (including previous versions after you have amended a commit) using git reflog
. From there, once you found the commit SHA you need, you can cherry-pick in in the branch you need it.