What is a git diff, how to do it and what is it for?

1

I have a problem with my project.

I make contributions to a git project, and when checking the Master branch, I saw that there are missing some methods that have in a branch, but do not have in the Master. I do not know how many and which are these methods, so I think it would be good to do a DIFF between branchs, however, I do not know if it is the right thing to do to solve this problem and I also do not know the correct syntax for this. Another pontp is, will a DIFF command solve this divergence between branchs? At some point in the development and commits, these methods were lost, for some conflicts that arose, many people are upgrading the same classes. Can anyone help me solve this problem?

    
asked by anonymous 13.08.2018 / 14:57

1 answer

2

The syntax for the diff between branches is:

$ git diff origin/[branch1]..origin/[branch2]

The diff will not resolve the divergence, it will only show the difference between them. To resolve you can either merge the branches or a rebase and resolve the conflicts in the files.

If you need to check the history of any file changes, you can run the command:

$ git log -p caminho/do/arquivo

You can still use git's cherry pick to restore files to specific commits.

    
13.08.2018 / 15:18