I am working in a repository that contains hundreds of branches and dozens of active developers.
Yesterday, to resolve an urgent problem, I committed my work to my branch (called feature/new-foo
), fixed something in a new branch off master (after git fetch
), and went home.
This morning, I forgot what my feature/new-foo
branch was called.
I have tried the following:
git log --all
, which shows all recent commits from all branches, to no availgit branch -v | grep "foo"
, which searched for all branches with the word foo
in it; no good results were found.git for-each-ref --sort=-committerdate refs/heads/
, which sorts all branches by commit date; still nothinggit stash list
, just in case, and my changes weren't there either.All I remember from my work was the addition of keywords class Edge
.
Are there any commands I should try, or is my feature commit forever lost in the sea of branches and commits?
This is not related to: this problem
If you want to use the keywords you added to look for the branch, you could check the commit logs of each branch:
git log --oneline -S "class Edge" --source --all
This will list references of all commits that introduced or removed the string "class Edge".
Assuming that there haven't been a lot of commits, you could run this command to order your branches by last commit. At least then, you can see which branches you've committed to recently to try to figure out which one it might be.
# How can I get a list of git branches, ordered by most recent commit?
# http://stackoverflow.com/q/5188320/165988
git for-each-ref --sort=-committerdate refs/heads/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With