DEV Community

Luu Vinh Loc
Luu Vinh Loc

Posted on

Write a git diff command result to file to manage the big changes and ignore the lock files

Write the result of a git diff command to a file to manage large changes and ignore lock files.

git diff branch-name-0..branch-name-1 -- . ':(exclude)*.lock' > git.diff
Enter fullscreen mode Exit fullscreen mode

When ignoring multiple files:

git diff branch-name-0..branch-name-1 -- . ':(exclude)*.lock' ':(exclude)*.yaml' ':(exclude)*.yml' ':(exclude)*.json' > git.diff
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
jerry_schneider profile image
Jerry Schneider

Nice! I wrote a bash function which uses fzf which let's you select exactly which files to include in the diff. I should augment it with an exclusion list that can be defined in bashrc. github.com/schnej7/dotfiles/blob/m...