I create a new branch when a new issue pops up. These branches are named starting issu
. After merging with master
these branches are deleted. I wanted to get a list of all such branches. I was able to get it using git reflog
>git reflog
55e8b45 (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: merge issu4-HasScript-and-HasFormat-checkbox-toggle: Fast-forward
7caf2c6 HEAD@{1}: checkout: moving from issu4-HasScript-and-HasFormat-checkbox-toggle to master
55e8b45 (HEAD -> master, origin/master, origin/HEAD) HEAD@{2}: commit (amend): Column validation including Has-Script and Has-Format
490a29a HEAD@{3}: commit: Column validatio inclnsuding Has Script and Has Format
7caf2c6 HEAD@{4}: checkout: moving from master to issu4-HasScript-and-HasFormat-checkbox-toggle
7caf2c6 HEAD@{5}: merge issu3-make-SFTPFingerprint-required: Fast-forward
fbad7cd HEAD@{6}: checkout: moving from issu3-make-SFTPFingerprint-required to master
...
Is there any way to filter these entries to get all merges starting with issu
.
I am trying to get all deleted branches that were merged into the master and started with issu
. Other solutions that get these are also fine.
I searched a lot and could not find a solution.
Update:
I am using windows. The solution that i currently have is
git reflog | findstr /c:"merge issu"
Is there any solution in git itself?
git reflog directories can be found at . git/logs/refs/heads/. , . git/logs/HEAD , and also . git/logs/refs/stash if the git stash has been used on the repo.
Looking up changes for a specific commit If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .
a reflog is a very special “branch” that records each position of HEAD in the last 30 days (by default). So removed branches won't be purged by prune until after waiting for 30 days, when the last reference to them will finally be released. reflog history is not shared – it is exclusive to your repository.
Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository. Reflogs are useful in various Git commands, to specify the old value of a reference. For example, HEAD@{2} means "where HEAD used to be two moves ago", master@{one. week.
You can use this command,
git reflog --grep-reflog=<pattern>
In your case it would be, git reflog --grep-reflog="merge issu"
Link
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