2

I have accidentally committed one binary file in one of my branches which take around 8Mb, Is there a way to find out

  1. Which branch is it?
  2. Which commit is it?

So that I can delete the corresponding branch from Github

Asnim P Ansari
  • 1,932
  • 1
  • 18
  • 41
  • I think this could help you : https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history – Alice Oct 07 '19 at 12:10
  • @Sami The linked post is mainly a way to filter files along size. When you know the file name/path, this is overkill. – Romain Valeri Oct 07 '19 at 12:14

1 Answers1

1
git log --oneline -- path/to/file

will output a list of all commits modifying this path.

If you just introduced the file, you'll have only one commit, but even if you made a few commits since, you could then use the hash(es) found there to list branches involved :

git branch -a --contains <commitHash>
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61