I want to check that how much a file changed from one branch to another in git.
- 
                    Lets hope and wait for answer. – Vishal Kumar Oct 01 '17 at 07:29
- 
                    Possible duplicate of [Showing which files have changed between two revisions](https://stackoverflow.com/questions/822811/showing-which-files-have-changed-between-two-revisions) – pjpj Oct 01 '17 at 10:19
3 Answers
I have 2 solutions:
(1) See number of difference files immediately.
git diff branch_foo branch_bar --name-only --oneline --numstat | wc -l
(2) Export to text file, then count number of lines.
git diff branch_foo branch_bar --name-only --oneline > result.txt
then open file result.txt, count number of lines.
For example
git clone https://github.com/spring-projects/spring-boot.git
cd spring-boot
git diff master heads/remotes/upstream/gh-6030 --name-only --oneline --numstat | wc -l
git diff master heads/remotes/upstream/gh-6030 --name-only --oneline > result.txt
 
    
    - 46,709
- 59
- 215
- 313
This is my working flow, probably can give you some ideas.
Normally I have branch master and develop and have an alias in my shell, named gd
alias gd="echo master diff:; git diff --name-status master develop"
This helps me to list all the files that have changed between the branches (master and develop).
Next, if I would like to only see the differences between two files I use:
 git d develop master -- file.txt
Notice the d instead of using diff:
In this case d in an alias in my .gitconfig:
[alias]
    d = difftool
[diff]
    tool = vimdiff 
This helps me to use vimdiff so that I can easily see the changes, by using the [diff] options, you can add your tool of preference, hope this can help you or give some ideas about how to extend the .gitconfig to simplify repetitive tasks.
 
    
    - 25,603
- 10
- 76
- 131
 
    