21
I implemented a new functionality for my program in an Func1.cpp file, in the branch Func1. Then I created another feature - in the file Func2.cpp -, but I forgot to create in a branch separate Func2. Now, I would like to separate a branch for each feature.
For that, I need to know which commits change the Func1.cpp file and which ones change Func2.cpp. So I can make one rebase --interactive to then separate the branches.
I tried to git show <SHA1>, but it shows me information of diff that I don’t need.
Question: How can I find out which commits change which files?
The flag
--followmust be used before<arquivo>?– Yamaneko
@Victorhugo Yes! Good observation.
– talles
if you are in a branch and want to check changes in another branch you can use
git log --follow outro_branch -- <arquivo>.– Bruno Coimbra
@Brunocoimbra What does this mean
--? I’ve used it before to reset modifications to a file:git checkout -- <arquivo>.– Yamaneko
@Victorhugo
--in the parameter--followIt has no special sense, it’s just a convention. Usually simple options (one letter) are accompanied by a dash, and complete options (whole words) of two strokes (case of--follow). Already the isolated use of--in the git checkout is a way of telling git that you are referring to a file (not an eventual branch).– talles
the
--is used to indicate that command line options are finished. likegitaccepts options in formats-h,--help,nome_do_branchandnome_do_arquivoit is necessary to somehow differentiate the last 2 formats.– Bruno Coimbra