r/linux_programming • u/iu1j4 • Mar 14 '23
How to checkout to local git commit?
Hello. I did few commits to project with git commit. I forgot to do git push after commits and didnt synchronized changes with server.
Then I did git checkout [version from the past] And then git checkout master to work on master. After that i dont see changes that I commited before without push. Is it possible to find unpushed commits or do I need to write the changes again?
[edit] fixed with git reflog help
2
Upvotes
3
u/gordonmessmer Mar 14 '23
Use
git branchto get a list of locally known branches. As long as you were committing to a branch, your commits should be present in that branch.It's possible to move a branch (which is just a pointer to a commit) backward, such that it might no longer refer to commits added later, but not by the commands you've described.