How do I see which commits change a certain file?


I've implemented a new functionality for my program in a Func1.cpp file, in the Func1 branch. Then I created one more functionality - in the file Func2.cpp -, but I forgot to create in a separate branch Func2 . Now I'd like to separate a branch for each feature.

To do this, I need to know which commits changes the Func1.cpp file and which changes Func2.cpp. So I can make a rebase --interactive to then separate the branches. I've tried git show <SHA1> , but it shows me diff information I do not need.

Question: How can I find out which commits changes which files?

asked by anonymous 12.12.2013 / 02:44

3 answers

git log <arquivo>

To make git understand and follow the same file when renamed:

git log --follow <arquivo>
12.12.2013 / 02:48

I recommend using an alias in .gitconfig to query this type of information. Put in your ~/.gitconfig , in the alias section:

    ll = log --pretty=format:"%C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate --numstat

Done, now git ll will report each commit with the list of files changed by it, similar to:

afe7f7c first commit [Elias]
2       0       src/
11      0       src/

f732435 adicionado notebook [Elias]
100     0       testes.ipynb
12.12.2013 / 03:56

Instead of git show try git log <nome do arquivo> .

12.12.2013 / 02:46